We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 93f24a0 commit d0c27ffCopy full SHA for d0c27ff
compiler/src/dotty/tools/dotc/ast/Desugar.scala
@@ -428,6 +428,11 @@ object desugar {
428
}
429
else originalTparams
430
431
+ if mods.is(Trait) then
432
+ for vparams <- originalVparamss; vparam <- vparams do
433
+ if vparam.tpt.isInstanceOf[ByNameTypeTree] then
434
+ report.error(em"implementation restriction: traits cannot have by name parameters", vparam.srcPos)
435
+
436
// Annotations on class _type_ parameters are set on the derived parameters
437
// but not on the constructor parameters. The reverse is true for
438
// annotations on class _value_ parameters.
tests/neg/i9886.scala
@@ -0,0 +1,2 @@
1
+trait D(l: => Any): // error
2
+ def f = l
0 commit comments