File tree 5 files changed +8
-2
lines changed
compiler/src/dotty/tools/dotc
5 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,8 @@ object SymUtils:
64
64
65
65
def isSuperAccessor (using Context ): Boolean = self.name.is(SuperAccessorName )
66
66
67
+ def isNoValue (using Context ): Boolean = self.is(Package ) || self.isAllOf(JavaModule )
68
+
67
69
/** Is this a type or term parameter or a term parameter accessor? */
68
70
def isParamOrAccessor (using Context ): Boolean =
69
71
self.is(Param ) || self.is(ParamAccessor )
Original file line number Diff line number Diff line change @@ -713,7 +713,7 @@ object Checking {
713
713
714
714
def checkValue (tree : Tree )(using Context ): Unit =
715
715
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
717
717
report.error(JavaSymbolIsNotAValue (sym), tree.srcPos)
718
718
719
719
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
3245
3245
rememberSearchFailure(qual,
3246
3246
SearchFailure (qual.withType(NestedFailure (ex.toMessage, selectionProto))))
3247
3247
3248
+ if qual.symbol.isNoValue then return EmptyTree
3249
+
3248
3250
// try an extension method in scope
3249
3251
try
3250
3252
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
2
2
implicit def a ( : ) = 1 () // error // error // error
3
3
}
You can’t perform that action at this time.
0 commit comments