Skip to content

Fix subtyping checks involving ThisType and PolyParam #192

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

Merged
merged 1 commit into from
Nov 11, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/dotty/tools/dotc/core/TypeComparer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ class TypeComparer(initctx: Context) extends DotClass {
if (solvedConstraint && (constraint contains tp2)) isSubType(tp1, bounds(tp2).lo)
else
isSubTypeWhenFrozen(tp1, bounds(tp2).lo) || {
if (isConstrained(tp2)) addConstraint(tp2, tp1.widen, fromBelow = true)
if (isConstrained(tp2)) addConstraint(tp2, tp1.widenExpr, fromBelow = true)
else (ctx.mode is Mode.TypevarsMissContext) || secondTry(tp1, tp2)
}
}
Expand Down
1 change: 1 addition & 0 deletions test/dotc/tests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class tests extends CompilerTest {
@Test def pos_approximateUnion = compileFile(posDir, "approximateUnion", doErase)
@Test def pos_tailcall = compileDir(posDir + "tailcall/", doErase)
@Test def pos_nullarify = compileFile(posDir, "nullarify", "-Ycheck:nullarify" :: doErase)
@Test def pos_subtyping = compileFile(posDir, "subtyping", doErase)

@Test def pos_all = compileFiles(posDir, twice)
@Test def new_all = compileFiles(newDir, twice)
Expand Down
6 changes: 6 additions & 0 deletions tests/pos/subtyping.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class A {
def test1(): Unit = {
implicitly[this.type <:< this.type]
implicitly[this.type <:< A]
}
}