File tree Expand file tree Collapse file tree 1 file changed +3
-12
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 1 file changed +3
-12
lines changed Original file line number Diff line number Diff line change @@ -552,22 +552,13 @@ trait Checking {
552
552
553
553
/** Check that inline is only used on valid trees */
554
554
def checkInlineKeyword (tree : tpd.Tree )(implicit ctx : Context ) = {
555
- def errorOn (what : String ) =
556
- ctx.error(" inlined keyword cannot be used on " + what, tree.pos)
557
555
val sym = tree.symbol
556
+ def error () = ctx.error(" inlined keyword cannot be used on " + ctx.kindString(sym), tree.pos)
558
557
if (sym is Inline ) {
559
558
tree match {
560
- case _ : TypeDef =>
561
- if (! sym.isClass) errorOn(" type" )
562
- else if (sym.is(Trait )) errorOn(" trait" )
563
- else if (sym.is(Abstract )) errorOn(" abstract class" )
564
- else errorOn(" class" ) // Remove this to allow inline classes
565
- case _ : ValDef =>
566
- if (sym.is(Module )) errorOn(" object" )
567
- else if (sym.is(Mutable )) errorOn(" var" )
568
- else if (sym.is(Lazy )) errorOn(" lazy val" )
559
+ case _ : TypeDef => error()
560
+ case _ : ValDef if sym.is(Module ) || sym.is(Mutable ) || sym.is(Lazy ) => error()
569
561
case _ =>
570
-
571
562
}
572
563
}
573
564
}
You can’t perform that action at this time.
0 commit comments