Skip to content

Commit 7406ddb

Browse files
committed
Fix crash
1 parent 29a350f commit 7406ddb

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

compiler/src/dotty/tools/dotc/transform/init/Objects.scala

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1224,7 +1224,12 @@ object Objects:
12241224
val funRef = fun1.tpe.asInstanceOf[TermRef]
12251225
val unapplyResTp = funRef.widen.finalResultType
12261226

1227-
val receiver = evalType(funRef.prefix, thisV, klass)
1227+
val receiver = fun1 match
1228+
case ident: Ident =>
1229+
evalType(funRef.prefix, thisV, klass)
1230+
case select: Select =>
1231+
eval(select.qualifier, thisV, klass)
1232+
12281233
val implicitValues = evalArgs(implicits.map(Arg.apply), thisV, klass)
12291234
// TODO: implicit values may appear before and/or after the scrutinee parameter.
12301235
val unapplyRes = call(receiver, funRef.symbol, TraceValue(scrutinee, summon[Trace]) :: implicitValues, funRef.prefix, superType = NoType, needResolve = true)
@@ -1413,7 +1418,7 @@ object Objects:
14131418
resolveThis(tref.classSymbol.asClass, thisV, klass)
14141419

14151420
case _ =>
1416-
throw new Exception("unexpected type: " + tp)
1421+
throw new Exception("unexpected type: " + tp + ", Trace:\n" + Trace.show)
14171422
}
14181423

14191424
/** Evaluate arguments of methods and constructors */
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
object Test:
2+
val RootPackage = "_root_/"
3+
val s"${RootPackageName @ _}/" = RootPackage: @unchecked

0 commit comments

Comments
 (0)