diff options
author | Martin Odersky <odersky@gmail.com> | 2016-12-22 13:58:49 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-12-22 13:58:59 +0100 |
commit | 9474382efe948da34c68bce9a76890bb22e367e4 (patch) | |
tree | acd39b852cea555d23b3e928ffc029d6919ed948 /compiler/src/dotty/tools/dotc/typer/TypeAssigner.scala | |
parent | 098c50ac83eb4d18b23a1ed888cf601053c46ae6 (diff) | |
download | dotty-9474382efe948da34c68bce9a76890bb22e367e4.tar.gz dotty-9474382efe948da34c68bce9a76890bb22e367e4.tar.bz2 dotty-9474382efe948da34c68bce9a76890bb22e367e4.zip |
Fix #1845: Survive illegal this-type prefixes
Diffstat (limited to 'compiler/src/dotty/tools/dotc/typer/TypeAssigner.scala')
-rw-r--r-- | compiler/src/dotty/tools/dotc/typer/TypeAssigner.scala | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/src/dotty/tools/dotc/typer/TypeAssigner.scala b/compiler/src/dotty/tools/dotc/typer/TypeAssigner.scala index 4a97648f5..5c07b7bcf 100644 --- a/compiler/src/dotty/tools/dotc/typer/TypeAssigner.scala +++ b/compiler/src/dotty/tools/dotc/typer/TypeAssigner.scala @@ -282,7 +282,9 @@ trait TypeAssigner { def assignType(tree: untpd.This)(implicit ctx: Context) = { val cls = qualifyingClass(tree, tree.qual.name, packageOK = false) - tree.withType(cls.thisType) + tree.withType( + if (cls.isClass) cls.thisType + else errorType("not a legal qualifying class for this", tree.pos)) } def assignType(tree: untpd.Super, qual: Tree, inConstrCall: Boolean, mixinClass: Symbol = NoSymbol)(implicit ctx: Context) = { |