Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Codegen fails if instance var has no type defined #1

Closed
waj opened this issue Dec 10, 2012 · 1 comment
Closed

Codegen fails if instance var has no type defined #1

waj opened this issue Dec 10, 2012 · 1 comment

Comments

@waj
Copy link
Member

waj commented Dec 10, 2012

Example:

class Foo
  def foo
    @x
  end
end

Foo.new.foo
@asterite
Copy link
Member

I tried to write the Lexer and has the same probelm.

I fixed it (didn't commit it) by doing this: when looking up an instance variable for read-access, if it doesn't have a type, assign it the Nil type. I think this can work, but to make it better we should bind it to a fictitious variable that has Nil type, so that when you assign it a value it becomes a union of Nil and that value's type.

What do you think?

@waj waj closed this as completed Dec 26, 2012
bcardiff pushed a commit that referenced this issue Jul 27, 2015
@rdp rdp mentioned this issue Oct 29, 2016
bcardiff referenced this issue in bcardiff/crystal Jan 2, 2017
fix src to be able to build the compiler (in linux)
oprypin pushed a commit to oprypin/crystal that referenced this issue Sep 9, 2019
oprypin pushed a commit to oprypin/crystal that referenced this issue Sep 9, 2019
oprypin pushed a commit to oprypin/crystal that referenced this issue Sep 9, 2019
oprypin pushed a commit to oprypin/crystal that referenced this issue Sep 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants