Commit 4ae3d64
committed
Fix test
We have the following subtyping result:
```scala
Subtype trace:
==> Array#262[String#810] <:< Array#262[String#810]
==> Array#262[String#810] <:< Array#262[String#810] recur
<== Array#262[String#810] <:< Array#262[String#810] recur = false
<== Array#262[String#810] <:< Array#262[String#810] = false
```
In `TypeComparer.compareAppliedType2`, the method just returns false
because `typcon2.typeParams` is empty:
```
def compareAppliedType2(tp2: AppliedType, tycon2: Type, args2: List[Type]): Boolean = {
val tparams = tycon2.typeParams
if (tparams.isEmpty) return false
```
The reason why `ftypcon1.typeParams` is empty is because we are
running the subtyping check after erasure. The following code works
without any problem:
```scala
atPhase(typerPhase) { arrayOfString =:= arg.tpe }
```
Before the change the two `Array[String]` and `Array[String]` point to
the same object, thus they go through the short-cut `tp1 eq tp2` in
`TypeComparer`, thus never reaches the line
`TypeComparer.compareAppliedType2`.1 parent 5cf9e0b commit 4ae3d64
1 file changed
+9
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
33 | 32 | | |
34 | 33 | | |
35 | 34 | | |
36 | 35 | | |
| 36 | + | |
37 | 37 | | |
38 | | - | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
39 | 46 | | |
40 | 47 | | |
41 | 48 | | |
| |||
0 commit comments