Skip to content

Super-call in intersection type not type safe #2677

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

Closed
freddie-freeloader opened this issue Jun 4, 2017 · 3 comments
Closed

Super-call in intersection type not type safe #2677

freddie-freeloader opened this issue Jun 4, 2017 · 3 comments

Comments

@freddie-freeloader
Copy link

Consider:

> trait A { def x = "foo" }
> trait B { def x = 42 }
> val AB = new A with B { override def x = super.x }
> AB.x
java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer

I would expect the overriding method to be rejected, since it has type String and it is expected to be Int & String.

@amanjpro
Copy link

I will be working on this

@smarter
Copy link
Member

smarter commented Jun 17, 2017

@amanjpro there is already a fix at: #2768

@amanjpro
Copy link

Ah, thanks for informing me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants