Skip to content

Commit 1a538af

Browse files
committed
Fix #1457: Three incompatbilities with scalac
Two of these are unavoidable. I moved the tests to diabled/not-representable and added in each case a comment to the main scala file detailing why there is a deviation. The last one (import-rewrite) is fixed.
1 parent 76c3e99 commit 1a538af

File tree

9 files changed

+27
-6
lines changed

9 files changed

+27
-6
lines changed

src/dotty/tools/dotc/typer/ImportInfo.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ class ImportInfo(symf: => Symbol, val selectors: List[untpd.Tree], val isRootImp
6464
myExcluded += name
6565
case Pair(Ident(from: TermName), Ident(to: TermName)) =>
6666
myMapped = myMapped.updated(to, from)
67+
myExcluded += from
6768
myOriginals += from
6869
case Ident(nme.WILDCARD) =>
6970
myWildcardImport = true

tests/pending/hkt/hkt.scala renamed to tests/disabled/not-representable/hkt/hkt.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// This one is unavoidable. Dotty does not allow several overloaded
2+
// parameterless methods, so it picks the one in the subclass.
3+
14
import scala.language.higherKinds
25
// Minimal reproduction for:
36
// scala.collection.mutable.ArrayStack.empty[Int]
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// This one should be rejected according to spec. The import takes precedence
2+
// over the type in the same package because the typeis declared in a
3+
// different compilation unit. scalac does not conform to spec here.
4+
package naming.resolution
5+
6+
import java.nio.file._ // Imports `Files`
7+
8+
object Resolution {
9+
def gimmeFiles: Files = Files.list(Paths.get("."))
10+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
$ scalac tests/pending/naming-resolution/*.scala
2+
$ ./bin/dotc tests/pending/naming-resolution/*.scala
3+
tests/pending/naming-resolution/callsite.scala:6: error: type mismatch:
4+
found : java.util.stream.Stream[java.nio.file.Path]
5+
required: java.nio.file.Files
6+
def gimmeFiles: Files = Files.list(Paths.get("."))
7+
^
8+
one error found
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package naming
2+
3+
package object resolution {
4+
type Files = java.util.stream.Stream[java.nio.file.Path]
5+
}

tests/pending/import-rewrite/compiler.error

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)