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

disallow other type inherit from String #3882

Merged
merged 1 commit into from
Jan 13, 2017

Conversation

firejox
Copy link
Contributor

@firejox firejox commented Jan 13, 2017

solved #3864
if we try to inherit from String, compiler will give such error

class Foo < String
end
Error in test3.cr:1: cannot inherit from String

class Foo < String
      ^

Resolves #3864

@david50407
Copy link
Contributor

Any other LLVM-relatived built-in types should also forbid the inheritance?

@asterite
Copy link
Member

@firejox This is genius!!

Could you remove the spec? It doesn't add anything, it's not testing something of the compiler. If the macro inherited is there, and it raises, that should work, we should test that.

@firejox firejox force-pushed the forbid-string-inherited branch from f1d0f83 to 4946996 Compare January 13, 2017 13:14
@firejox
Copy link
Contributor Author

firejox commented Jan 13, 2017

@david50407 Well, LLVM-relatived built-in types are declared as struct. They cannot be inherited.

@asterite Sure :)

@mverzilli mverzilli added kind:bug A bug in the code. Does not apply to documentation, specs, etc. pr:needs-review topic:compiler labels Jan 13, 2017
@asterite
Copy link
Member

@firejox Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. pr:needs-review topic:compiler
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Compiler error when inheriting from String
4 participants