-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix #1378: Propagate more knowledge of result type into applications #1395
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
Error messages were suppressed so far, now get printed.
As observed by @smarter, makes sense to do this.
If an application has functions with implicit parameter types we need to be more aggressive about propagating knowledge of the expected result type into the constraint. Fixes scala#1378.
// todo: fill with methods from TreeInfo that only apply to untpd.Tree's | ||
import TreeInfo._ | ||
|
||
def isFunctionWithImplicitParamType(tree: Tree) = tree match { |
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.
I find the use of implicit
in this context confusing, how about unknown
instead?
This should have been done in a PR that was merged before.
Interestingly, adding mutable.BufferLike to the whitelist succeeds under junit but fails under partest. Unfortunately I can't see any output in the log indicating what went wrong. I only see this: !! 306 - pos/compileStdLib [compilation failed] # Failed test paths (this command will update checkfiles) test/partest --update-check \ /Users/odersky/workspace/dotty/tests/partest-generated/pos/compileStdLib
More info on failing stdlib test: If I run the test alone in partest it succeeds. Unfortunately, this looks like we might have a race. Difficult to say without more test output. I'll make a separate issue #1401 so that we can complete this PR. |
See #1401 (comment) for the log of failure in CI. |
LGTM |
Generate java signatures for private members as well (scala#1395)
Generate java signatures for private members as well (scala#1395)
This was originally added in scala#1395 to make the following compile: (1, x => 2): (Int, Int => Int) But reverting this change doesn't break anything anymore: the other call to `constrainResult` in `Application#init` is enough to propagate the constraint needed to type lambda. The strange thing is that this call already existed before scala#1395, I don't know why it wasn't enough back then.
This was originally added in scala#1395 to make the following compile: (1, x => 2): (Int, Int => Int) But reverting this change doesn't break anything anymore: the other call to `constrainResult` in `Application#init` is enough to propagate the constraint needed to type lambda. The strange thing is that this call already existed before scala#1395, I don't know why it wasn't enough back then.
In the presence of implicits, this a delicate dance. On the one hand, we need to propagate
knowledge of result types into applications in order to infer parameters as shown in i1378.scala.
On the other hand, we might go down a wrong path with this, if for instance we really meant to insert an implicit on the result type.
Review by @nicolasstucki or @smarter.