File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -467,8 +467,11 @@ object Checking {
467
467
if (sym.is(Trait ) && sym.is(Final ))
468
468
fail(TraitsMayNotBeFinal (sym))
469
469
// Skip ModuleVal since the annotation will also be on the ModuleClass
470
- if (sym.hasAnnotation(defn.TailrecAnnot ) && ! sym.isOneOf(Method | ModuleVal ))
471
- fail(TailrecNotApplicable (sym))
470
+ if sym.hasAnnotation(defn.TailrecAnnot ) then
471
+ if ! sym.isOneOf(Method | ModuleVal ) then
472
+ fail(TailrecNotApplicable (sym))
473
+ else if sym.is(Inline ) then
474
+ fail(" Inline methods cannot be @tailrec" )
472
475
if (sym.hasAnnotation(defn.NativeAnnot )) {
473
476
if (! sym.is(Deferred ))
474
477
fail(NativeMembersMayNotHaveImplementation (sym))
Original file line number Diff line number Diff line change
1
+ import scala .annotation .tailrec
2
+
3
+ @ tailrec inline def foo () = ??? // error
You can’t perform that action at this time.
0 commit comments