@@ -251,6 +251,7 @@ class Synthesizer(typer: Typer)(using @constructorOnly c: Context):
251
251
private def companionPath (mirroredType : Type , cls : Symbol , pre : Type , span : Span )(using Context ) =
252
252
val clsType =
253
253
// ok to assume healPrefix will succeed because `cls` and `pre` derive from the same type.
254
+ // TODO: will fail, e.g. for value alias to case object - we still need to support `scala.package.None.type`
254
255
TypeOps .healPrefix(mirroredType.mirrorCompanionRef, pre).toOption.get
255
256
val ref = pathFor(clsType)
256
257
assert(ref.symbol.is(Module ) && (cls.is(ModuleClass ) || (ref.symbol.companionClass == cls)))
@@ -330,6 +331,10 @@ class Synthesizer(typer: Typer)(using @constructorOnly c: Context):
330
331
mirrorRef.cast(mirrorType)
331
332
end makeProductMirror
332
333
334
+ if pre == NoPrefix then
335
+ report.error(i " $mirroredType is not a valid prod type, because it does not have a prefix " )
336
+ else
337
+ report.warning(i " prod mirror with $mirroredType: pre $pre" )
333
338
mirroredType match
334
339
case AndType (tp1, tp2) =>
335
340
productMirror(tp1, formal, span).orElse(productMirror(tp2, formal, span))
@@ -359,6 +364,10 @@ class Synthesizer(typer: Typer)(using @constructorOnly c: Context):
359
364
val pre = TypeOps .extractPrefix(mirroredType) match
360
365
case pre if pre.exists => pre
361
366
case _ => return EmptyTree
367
+ // if pre == NoPrefix then
368
+ // report.error(i"$mirroredType is not a valid sum type, because it does not have a prefix")
369
+ // else
370
+ // report.warning(i"sum mirror with $mirroredType: pre $pre")
362
371
val cls = mirroredType.classSymbol
363
372
val useCompanion = cls.useCompanionAsSumMirror
364
373
0 commit comments