diff options
author | Guillaume Martres <smarter@ubuntu.com> | 2014-10-14 20:55:55 +0200 |
---|---|---|
committer | Guillaume Martres <smarter@ubuntu.com> | 2014-11-11 08:47:44 +0100 |
commit | 629dae0d00a51c5bb097d968280238da72d01f91 (patch) | |
tree | 6388efbfe5ec30a0a1abc80d93924b6ae8b1a2e8 | |
parent | 892f7bdb4c35f701f7d925404ac55ebaa5566ae0 (diff) | |
download | dotty-629dae0d00a51c5bb097d968280238da72d01f91.tar.gz dotty-629dae0d00a51c5bb097d968280238da72d01f91.tar.bz2 dotty-629dae0d00a51c5bb097d968280238da72d01f91.zip |
Fix subtyping checks involving ThisType and PolyParam
-rw-r--r-- | src/dotty/tools/dotc/core/TypeComparer.scala | 2 | ||||
-rw-r--r-- | test/dotc/tests.scala | 1 | ||||
-rw-r--r-- | tests/pos/subtyping.scala | 6 |
3 files changed, 8 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/core/TypeComparer.scala b/src/dotty/tools/dotc/core/TypeComparer.scala index 5261f7dcf..feb4c6b74 100644 --- a/src/dotty/tools/dotc/core/TypeComparer.scala +++ b/src/dotty/tools/dotc/core/TypeComparer.scala @@ -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) } } diff --git a/test/dotc/tests.scala b/test/dotc/tests.scala index aafd5e924..966c231e4 100644 --- a/test/dotc/tests.scala +++ b/test/dotc/tests.scala @@ -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) diff --git a/tests/pos/subtyping.scala b/tests/pos/subtyping.scala new file mode 100644 index 000000000..a5e156780 --- /dev/null +++ b/tests/pos/subtyping.scala @@ -0,0 +1,6 @@ +class A { + def test1(): Unit = { + implicitly[this.type <:< this.type] + implicitly[this.type <:< A] + } +} |