-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add named params - first iteration #1019
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
That's strange, as the very same file succeeded being compiled by unit-tests. |
/rebuild |
We get OutOfMemoryErrors (GC overhead limit exceeded). Is there something one can do to fix this? |
/rebuild |
/rebuild -- trying to find out whether this is random or not. |
/rebuild |
84f0280
to
9153a1b
Compare
rebased to master |
We see: Native memory allocation (mmap) failed to map 2463629312 bytes for committing reserved memory. |
Tests pass locally. |
/rebuid |
/rebuild |
Try rebasing on top of master to get rid of the errors related to t7880.scala |
9153a1b
to
c443150
Compare
Note that no junit build will succeed until scala/scala-jenkins-infra#158 is merged and deployed, sorry about that. |
4ad5a69
to
e48ecb0
Compare
Get this in now? It's been lingering for a long time. |
e48ecb0
to
7a862ae
Compare
Rebased to master. This is ready to go in now. I know it is a big PR but it is an important one. If there are no reviews I'll merge. |
I'll do another pass on this today |
in.nextToken() | ||
otherArgs(NamedArg(name, argType()), namedTypeArg) | ||
case firstArg => | ||
if (in.token == EQUALS) println(s"??? $firstArg") |
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.
Don't use println in the compiler
Changes needed to support simple named type parameters. Not yet implemented: named arguments.
Types#underlyingClassRef and PostTyper#normalizeTree need to be changed so they can deal with partial named parameter lists.
After unpickling we might see an alias X = pre.X where pre =:= the ThisType of the enclosing class. But it might not be `eq` to it.
Named parameters cause some elements to be unpickled in a different order as they are pickled. In particular term parameter aliases and type parameter aliases seem to be swapped.
There is a before/after difference having to do with the order in which class declarations show up.
Needs to work also if named arg refers to an abstract type, not a parameter.
We had same fleyness in number of errors of cycle.scala which prompted this.
Also, add an unrelated test file to pos.
Was not fixed by accident then, so we do it here now.
The current Scala spec only considers methods without default parameters for overloading resolution (unless only a single one remains anyway after filtering by shape). This is needlessly restrictive. But dropping this restriction (as dotty does) can lead to ambiguity errors, which is why run/t8197 did not compile anymore. We fix the problem by a last try rule: If after asSpecific tests there are still several alternatives, and only one of them is without default arguments, pick that one. I tried an alternative rule which would make the distinction on default params earlier but that one fails for the overloaded tree copier functions in Trees.scala (the method with default parameters is also the one which is more specific).
Lets one also pass named arguments to methods.
7a862ae
to
90f8a22
Compare
Reviewer comments so far have been addressed. Are there others coming? |
Also fixes #78 |
Ready to merge? |
Subsumed by #1072 |
This PR adds named class parameters
[type A]
and named arguments toapplied types
T[A = U]
.This is not quite complete yet. We are still missing named arguments in method applications and patterns. Also, we need more tests in particular in what concerns type inference.