forked from scala/scala3
-
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.
Previously, i9994.scala failed when compiled with `-Ythrough-tasty` with: 7 | def foo: this.type = this | ^ | error overriding method foo in trait Foo of type => (Bar.this : pkg.Bar); | method foo of type => (Bar.this : pkg.Bar) has incompatible type The two types were pretty-printed the same but were actually: ExprType(ThisType(TypeRef(ThisType(TypeRef(ThisType(TypeRef(NoPrefix,module class <root>)),module class <empty>)),class Bar))) and ExprType(ThisType(TypeRef(ThisType(TypeRef(NoPrefix,module class <empty>)),class Bar))) Fixed by explicitly handling subtyping between two `ThisType` (previously we felt through to `fourthTry` were the type of the lhs was widened), this is a rare case because `ThisType` are interned, so usually two `ThisType` to the same class are `eq` and therefore `isSubType` returns true.
- Loading branch information
Showing
3 changed files
with
9 additions
and
49 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package pkg | ||
|
||
trait Foo: | ||
def foo: this.type | ||
|
||
final class Bar extends Foo: | ||
def foo: this.type = this |