Skip to content

Commit 76c3e99

Browse files
authored
Merge pull request #1464 from olafurpg/incompatibilities
Three incompatibilities with scalac.
2 parents bcfa3be + 233b809 commit 76c3e99

File tree

8 files changed

+64
-0
lines changed

8 files changed

+64
-0
lines changed

tests/pending/hkt/compiler.error

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
$ scalac tests/pending/hkt/*.scala
2+
$ ./bin/dotc tests/pending/hkt/*.scala
3+
tests/pending/hkt/hkt.scala:14: error: method empty in object Child does not take type parameters
4+
Child.empty[Int]
5+
^
6+
one error found

tests/pending/hkt/hkt.scala

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import scala.language.higherKinds
2+
// Minimal reproduction for:
3+
// scala.collection.mutable.ArrayStack.empty[Int]
4+
5+
abstract class Super[C[_]] {
6+
def empty[T]: C[T] = ???
7+
}
8+
9+
class Child[T]
10+
11+
object Child extends Super[Child] {
12+
def empty: Child[Nothing] = new Child()
13+
14+
Child.empty[Int]
15+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
$ scalac tests/pending/import-rewrite/*.scala
2+
$ ./bin/dotc tests/pending/import-rewrite/*.scala
3+
tests/pending/import-rewrite/rewrite.scala:5: error: value apply is not a member of java.io.File.type
4+
Seq("").map(File.apply)
5+
^
6+
one error found
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package file
2+
3+
class File private (val str: String) {
4+
def name: String = "name"
5+
}
6+
7+
object File {
8+
def apply(str: String): File = new File(str)
9+
}
10+
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package file
2+
import java.io.{File => JFile, _}, StreamTokenizer.{TT_EOF => eof}
3+
4+
object Main {
5+
Seq("").map(File.apply)
6+
// def name(file: File) = file.name
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package naming.resolution
2+
3+
import java.nio.file._ // Imports `Files`
4+
5+
object Resolution {
6+
def gimmeFiles: Files = Files.list(Paths.get("."))
7+
}
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+
}

0 commit comments

Comments
 (0)