forked from scala/scala
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request scala#8049 from adriaanm/pr7966-followup
ObjectTpeJava is truly unique; bounds; isAnyTpe
- Loading branch information
Showing
13 changed files
with
119 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
S.scala:1: error: class S needs to be abstract. Missing implementation for: | ||
def g(y: Int, z: java.util.List): Int // inherited from class J | ||
(Note that java.util.List does not match java.util.List[String]. To implement this raw type, use java.util.List[_ <: Object]) | ||
(Note that java.util.List does not match java.util.List[String]. To implement this raw type, use java.util.List[_]) | ||
class S extends J { | ||
^ | ||
one error found |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class Test { | ||
def foo(c: java.util.Collection[String]): Unit = { | ||
c.removeIf(x => true) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// scalac: -Ystop-after:refchecks -verbose -Ydebug -uniqid | ||
package java.lang | ||
|
||
/* This is a pretty random test that very indirectly tests `unique`ing of `ObjectTpeJavaRef` | ||
It's minimize from scala-js, where CI chanced on a compilation order that would first | ||
unique `TypeBounds(lo, ObjectTpe)`, and then `TypeBounds(lo, ObjectTpeJava)`, | ||
which would result in a Java reference to Object being replaced by one that is used | ||
to represent a Scala occurrence of a reference to Object, which is distinct from Any. | ||
When Java code refers to Object, it's taken as the same thing as Any, at least when | ||
it comes to =:= and `... <:< Object-in-java`. | ||
*/ | ||
import java.util.Iterator | ||
|
||
class Class[A](o: Object) | ||
|
||
class Comparable[A] { def compareTo(o: A): scala.Int = ??? } | ||
|
||
object System { | ||
def currentTimeMillis(): scala.Long = ??? | ||
|
||
def arraycopy(src: Object, srcPos: scala.Int, dest: Object, destPos: scala.Int, length: scala.Int): Unit = { | ||
import scala.{Boolean, Double} | ||
|
||
def mismatch(): Nothing = | ||
throw new ArrayStoreException("Incompatible array types") | ||
|
||
def copyPrim[@specialized T](src: Array[T], dest: Array[T]): Unit = { | ||
var i = length-1 | ||
while (i >= 0) { | ||
dest(i+destPos) = src(i+srcPos) | ||
i -= 1 | ||
} | ||
} | ||
|
||
def copyRef(src: Array[AnyRef], dest: Array[AnyRef]): Unit = { | ||
val x = (src.length, dest.length) | ||
|
||
var i = length-1 | ||
while (i >= 0) { | ||
dest(i+destPos) = src(i+srcPos) | ||
i -= 1 | ||
} | ||
} | ||
|
||
(src match { | ||
case src: Array[Boolean] => | ||
dest match { | ||
case dest: Array[Boolean] => copyPrim(src, dest) | ||
case _ => mismatch() | ||
} | ||
|
||
}) | ||
} | ||
|
||
def identityHashCode(x: Object): scala.Int = { | ||
x.getClass | ||
1 | ||
} | ||
} | ||
|
||
trait Iterable[T] { | ||
def iterator(): java.util.Iterator[T] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters