diff options
author | Martin Odersky <odersky@gmail.com> | 2016-08-26 18:29:17 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-08-26 18:29:25 +0200 |
commit | 99afc892839ca6209786ccd0dbca2544633be2e8 (patch) | |
tree | d1a48aee4e95bbee6a6399fd7157648572645778 /tests/disabled | |
parent | 1a538af06323f7d6cd471ae0af39842f26e9e7be (diff) | |
download | dotty-99afc892839ca6209786ccd0dbca2544633be2e8.tar.gz dotty-99afc892839ca6209786ccd0dbca2544633be2e8.tar.bz2 dotty-99afc892839ca6209786ccd0dbca2544633be2e8.zip |
Accommodate Scala2 name resolution scheme
Scala2 does not conform to spec Section 2, where it says:
Bindings of different kinds have a precedence defined on them:
1. Definitions and declarations that are local, inherited, or made available by a package clause and also defined in the same compilation unit as the reference, have highest precedence.
2. Explicit imports have next highest precedence.
3. Wildcard imports have next highest precedence.
4. Definitions made available by a package clause, but not also defined in the same compilation unit as the reference, have lowest precedence.
In fact Scala 2, merges (1) and (4) into highest precedence.
This commit simulates the Scala2 behavior under -language:Scala2, but gives a migration
warning. For the naming-resolution test case we get:
dotc *.scala -language:Scala2 -migration
callsite.scala:9: migration warning: Name resolution will change.
currently selected : naming.resolution.Files
in the future, without -language:Scala2: java.nio.file.Files'
where Files is a type in package object package which is an alias of java.util.stream.Stream[java.nio.file.Path]
Files' is a class in package file
def gimmeFiles: Files = Files.list(Paths.get("."))
^
one warning found
Diffstat (limited to 'tests/disabled')
3 files changed, 0 insertions, 23 deletions
diff --git a/tests/disabled/not-representable/naming-resolution/callsite.scala b/tests/disabled/not-representable/naming-resolution/callsite.scala deleted file mode 100644 index 036803a26..000000000 --- a/tests/disabled/not-representable/naming-resolution/callsite.scala +++ /dev/null @@ -1,10 +0,0 @@ -// This one should be rejected according to spec. The import takes precedence -// over the type in the same package because the typeis declared in a -// different compilation unit. scalac does not conform to spec here. -package naming.resolution - -import java.nio.file._ // Imports `Files` - -object Resolution { - def gimmeFiles: Files = Files.list(Paths.get(".")) -} diff --git a/tests/disabled/not-representable/naming-resolution/compiler.error b/tests/disabled/not-representable/naming-resolution/compiler.error deleted file mode 100644 index 81d6b3cfa..000000000 --- a/tests/disabled/not-representable/naming-resolution/compiler.error +++ /dev/null @@ -1,8 +0,0 @@ -$ scalac tests/pending/naming-resolution/*.scala -$ ./bin/dotc tests/pending/naming-resolution/*.scala -tests/pending/naming-resolution/callsite.scala:6: error: type mismatch: - found : java.util.stream.Stream[java.nio.file.Path] - required: java.nio.file.Files - def gimmeFiles: Files = Files.list(Paths.get(".")) - ^ -one error found diff --git a/tests/disabled/not-representable/naming-resolution/package.scala b/tests/disabled/not-representable/naming-resolution/package.scala deleted file mode 100644 index f0e26ee95..000000000 --- a/tests/disabled/not-representable/naming-resolution/package.scala +++ /dev/null @@ -1,5 +0,0 @@ -package naming - -package object resolution { - type Files = java.util.stream.Stream[java.nio.file.Path] -} |