Skip to content

Commit 04b86dc

Browse files
committed
Add missing case in accessibleSelection type
1 parent 12cf716 commit 04b86dc

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

compiler/src/dotty/tools/dotc/typer/TypeAssigner.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ trait TypeAssigner {
256256
def accessibleSelectionType(tree: untpd.RefTree, qual1: Tree)(implicit ctx: Context): Type = {
257257
var qualType = qual1.tpe.widenIfUnstable
258258
if (qualType.isLambdaSub) qualType = errorType(em"$qualType takes type parameters", qual1.pos)
259+
else if (!qualType.isInstanceOf[TermType]) qualType = errorType(em"$qualType is illegal as a selection prefix", qual1.pos)
259260
val ownType = selectionType(qualType, tree.name, tree.pos)
260261
ensureAccessible(ownType, qual1.isInstanceOf[Super], tree.pos)
261262
}

tests/neg/parser-stability-2.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
trait x0 {
2+
new _

0 commit comments

Comments
 (0)