-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix #2732: Allow wildcards in SAM types #3347
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
Conversation
The `isInstantiable` test as written is incorrect: Given tp = `java.util.function.Function[String, _ <: String]`, we will have: tref = skolem TermRef with underlying info `tp` selfType = `java.util.function.Function[String, tref#R]` (because of the `asSeenFrom`) `tref <:< selfType` is false, because `tref.underlying` is just `tp` and its return type parameter is a bounded wildcard, not a reference with `tref` as a prefix. In any case, I cannot think of a case where this function should return false, and no test failed when I removed it. So I'm removing it until someone can come up with a counter-example.
Here's a test:
With master this gives:
With this PR it compiles but we get a ClassCast exception at runtime. ~/workspace/dotty/tests/pos> java Test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As the test shows, we can't drop isInstantiatable
Indeed. Can you think of a way to fix |
test performance please (meta test of the bench infrastructure) |
performance test scheduled: 1 job(s) in queue, 0 running. |
performance test failed: Error line number: 19 [check /data/workspace/bench/logs/pull-3347-10-26-18.18.out for more information] |
For the moment it's too much of a context switch for me to think of a fix. |
Superceded by #4152 |
The
isInstantiable
test as written is incorrect:Given tp =
java.util.function.Function[String, _ <: String]
, we will have:tref = skolem TermRef with underlying info
tp
selfType =
java.util.function.Function[String, tref#R]
(because of theasSeenFrom
)tref <:< selfType
is false, becausetref.underlying
isjust
tp
and its return type parameter is a bounded wildcard, not a reference withtref
as a prefix.In any case, I cannot think of a case where this function should return
false, and no test failed when I removed it. So I'm removing it until
someone can come up with a counter-example.