-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Overriding method returning this type in final class from TASTy #9994
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
Comments
Also reproducible using |
the two types seen as incompatible both pretty print as 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))) which aren't subtypes apparently. It seems that we're missing a case in TypeComparer to handle two ThisType which are different but represent the same type? |
smarter
added a commit
to dotty-staging/dotty
that referenced
this issue
Oct 15, 2020
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).
smarter
added a commit
to dotty-staging/dotty
that referenced
this issue
Oct 15, 2020
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).
smarter
added a commit
to smarter/dotty
that referenced
this issue
Oct 21, 2020
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).
bishabosha
added a commit
that referenced
this issue
Oct 27, 2020
Fix #9994: Handle subtyping between two `ThisType`
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Full Reproduction
Minimized Reproduction
Bar.scala
The text was updated successfully, but these errors were encountered: