Skip to content
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
4 changes: 3 additions & 1 deletion compiler/src/dotty/tools/dotc/typer/TypeAssigner.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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) = {
Expand Down
3 changes: 3 additions & 0 deletions tests/neg/i1845.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
object Test {
type X = FooBar22.this // error
} // error