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.
2 parents c1da280 + d0c27ff commit eb92d6bCopy full SHA for eb92d6b
compiler/src/dotty/tools/dotc/ast/Desugar.scala
@@ -423,6 +423,11 @@ object desugar {
423
}
424
else originalTparams
425
426
+ if mods.is(Trait) then
427
+ for vparams <- originalVparamss; vparam <- vparams do
428
+ if vparam.tpt.isInstanceOf[ByNameTypeTree] then
429
+ report.error(em"implementation restriction: traits cannot have by name parameters", vparam.srcPos)
430
+
431
// Annotations on class _type_ parameters are set on the derived parameters
432
// but not on the constructor parameters. The reverse is true for
433
// 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