File tree Expand file tree Collapse file tree 5 files changed +8
-2
lines changed
compiler/src/dotty/tools/dotc Expand file tree Collapse file tree 5 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,8 @@ object SymUtils:
6464
6565 def isSuperAccessor (using Context ): Boolean = self.name.is(SuperAccessorName )
6666
67+ def isNoValue (using Context ): Boolean = self.is(Package ) || self.isAllOf(JavaModule )
68+
6769 /** Is this a type or term parameter or a term parameter accessor? */
6870 def isParamOrAccessor (using Context ): Boolean =
6971 self.is(Param ) || self.is(ParamAccessor )
Original file line number Diff line number Diff line change @@ -713,7 +713,7 @@ object Checking {
713713
714714 def checkValue (tree : Tree )(using Context ): Unit =
715715 val sym = tree.tpe.termSymbol
716- if sym.is( Flags . Package ) || sym.isAllOf( Flags . JavaModule ) && ! ctx.isJava then
716+ if sym.isNoValue && ! ctx.isJava then
717717 report.error(JavaSymbolIsNotAValue (sym), tree.srcPos)
718718
719719 def checkValue (tree : Tree , proto : Type )(using Context ): tree.type =
Original file line number Diff line number Diff line change @@ -3245,6 +3245,8 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
32453245 rememberSearchFailure(qual,
32463246 SearchFailure (qual.withType(NestedFailure (ex.toMessage, selectionProto))))
32473247
3248+ if qual.symbol.isNoValue then return EmptyTree
3249+
32483250 // try an extension method in scope
32493251 try
32503252 val nestedCtx = ctx.fresh.setNewTyperState()
Original file line number Diff line number Diff line change 1+ extension [T ](x : T ) def ext : T = x
2+ def foo = String .ext // error
Original file line number Diff line number Diff line change 1- package object A extends runtime.A {
1+ package object A extends runtime.A { // error
22 implicit def a ( : ) = 1 () // error // error // error
33}
You can’t perform that action at this time.
0 commit comments