Closed
Description
Compiler version
Scala 3.7.1-RC1-bin-20250325-701fa8a-NIGHTLY, JVM (21)
Minimized code
class annot(arg: Int) extends scala.annotation.StaticAnnotation
def foo(a: Int, b: Int @annot(a + a) = 42): Int = b
Output (click arrow to expand)
$ scala --server=false -S 3.nightly -Ydebug-error defaultArgBug.scala
-- Error: defaultArgBug.scala:2:30 ------
2 |def foo(a: Int, b: Int @annot(a + a) = 42): Int = b
| ^^^^^
| value of type <?> does not take parameters
java.lang.Exception: Stack trace
at java.base/java.lang.Thread.dumpStack(Thread.java:2210)
at dotty.tools.dotc.report$.error(report.scala:70)
at dotty.tools.dotc.typer.ErrorReporting$.errorType(ErrorReporting.scala:32)
at dotty.tools.dotc.typer.TypeAssigner.assignType(TypeAssigner.scala:313)
at dotty.tools.dotc.typer.TypeAssigner.assignType$(TypeAssigner.scala:17)
at dotty.tools.dotc.typer.Typer.assignType(Typer.scala:154)
at dotty.tools.dotc.ast.tpd$TypedTreeCopier.Apply(tpd.scala:680)
at dotty.tools.dotc.ast.tpd$ConservativeTreeCopier.Apply(tpd.scala:850)
at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1540)
at dotty.tools.dotc.ast.TreeTypeMap.transform(TreeTypeMap.scala:123)
at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform$$anonfun$1(Trees.scala:1646)
at scala.collection.immutable.List.mapConserve(List.scala:473)
at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1646)
at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1540)
at dotty.tools.dotc.ast.TreeTypeMap.transform(TreeTypeMap.scala:123)
at dotty.tools.dotc.ast.TreeTypeMap.apply(TreeTypeMap.scala:179)
at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:6331)
at dotty.tools.dotc.core.Annotations$Annotation.mapWith(Annotations.scala:71)
at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:6241)
at dotty.tools.dotc.typer.ProtoTypes$.dotty$tools$dotc$typer$ProtoTypes$$$wildApprox(ProtoTypes.scala:1022)
at dotty.tools.dotc.typer.ProtoTypes$.wildApprox(ProtoTypes.scala:1025)
at dotty.tools.dotc.typer.Namer.expectedDefaultArgType$1(Namer.scala:2193)
at dotty.tools.dotc.typer.Namer.rhsType$1(Namer.scala:2217)
at dotty.tools.dotc.typer.Namer.cookedRhsType$1(Namer.scala:2243)
at dotty.tools.dotc.typer.Namer.lhsType$1(Namer.scala:2244)
at dotty.tools.dotc.typer.Namer.inferredResultType(Namer.scala:2255)
at dotty.tools.dotc.typer.Namer.inferredType$1(Namer.scala:1837)
at dotty.tools.dotc.typer.Namer.valOrDefDefSig(Namer.scala:1843)
at dotty.tools.dotc.typer.Namer.defDefSig(Namer.scala:1969)
at dotty.tools.dotc.typer.Namer$Completer.typeSig(Namer.scala:843)
at dotty.tools.dotc.typer.Namer$Completer.completeInCreationContext(Namer.scala:1003)
at dotty.tools.dotc.typer.Namer$Completer.complete(Namer.scala:872)
at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:175)
at dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:190)
at dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:192)
at dotty.tools.dotc.core.SymDenotations$SymDenotation.ensureCompleted(SymDenotations.scala:393)
at dotty.tools.dotc.typer.Typer.retrieveSym(Typer.scala:3509)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3534)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3649)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3727)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3732)
at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3754)
at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3800)
at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:3222)
at dotty.tools.dotc.typer.Typer.typedTypeOrClassDef$1(Typer.scala:3550)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3554)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3649)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3727)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3732)
at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3754)
at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3800)
at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:33