aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools/dotc/typer/Typer.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2017-01-28 17:11:56 +1100
committerMartin Odersky <odersky@gmail.com>2017-01-28 17:12:05 +1100
commit678e8e47b630786df7548c1be5bee744342f826c (patch)
treeb747291c10d1d5f3bbea7cb12576e1ffedd5ba6c /compiler/src/dotty/tools/dotc/typer/Typer.scala
parent2bbf9ca068dd550ac68a83f33f7fc94505e6cfcc (diff)
downloaddotty-678e8e47b630786df7548c1be5bee744342f826c.tar.gz
dotty-678e8e47b630786df7548c1be5bee744342f826c.tar.bz2
dotty-678e8e47b630786df7548c1be5bee744342f826c.zip
Disallow polymorphic refinements in stuctural types.
We can't handle them with the proposed scheme. I made a note in #1886.
Diffstat (limited to 'compiler/src/dotty/tools/dotc/typer/Typer.scala')
-rw-r--r--compiler/src/dotty/tools/dotc/typer/Typer.scala4
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/src/dotty/tools/dotc/typer/Typer.scala b/compiler/src/dotty/tools/dotc/typer/Typer.scala
index ec4c135f7..48636c27c 100644
--- a/compiler/src/dotty/tools/dotc/typer/Typer.scala
+++ b/compiler/src/dotty/tools/dotc/typer/Typer.scala
@@ -1039,7 +1039,9 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
for (refinement <- refinements1) { // TODO: get clarity whether we want to enforce these conditions
typr.println(s"adding refinement $refinement")
checkRefinementNonCyclic(refinement, refineCls, seen)
- }
+ val rsym = refinement.symbol
+ if (rsym.info.isInstanceOf[PolyType] && rsym.allOverriddenSymbols.isEmpty)
+ ctx.error(i"polymorphic refinement $rsym without matching type in parent $tpt1 is no longer allowed", refinement.pos) }
assignType(cpy.RefinedTypeTree(tree)(tpt1, refinements1), tpt1, refinements1, refineCls)
}