File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -79,6 +79,7 @@ object Inliner {
7979 override def transform (t : Tree )(using Context ) =
8080 t match {
8181 case Inlined (t, Nil , expr) if t.isEmpty => expr
82+ case _ if t.isEmpty => t
8283 case _ => super .transform(t.withSpan(call.span))
8384 }
8485 }
Original file line number Diff line number Diff line change 1+ trait MyRange {
2+ inline def foreach (inline f : Int => Unit ): Unit
3+ }
4+
5+ transparent inline def MyRange (inline start : Int , inline end : Int ): MyRange = new {
6+ inline def foreach (inline f : Int => Unit ) = // error: Implementation restriction
7+ var i = start
8+ val e = end
9+ while (i < e) {
10+ f(i)
11+ i += 1
12+ }
13+ }
14+
15+ object App {
16+ val count : Int = 4
17+ for (i <- MyRange (0 , count)) { // error: Deferred inline method foreach in trait MyRange cannot be invoked
18+ Console .println(" Number: " + i)
19+ }
20+ }
You can’t perform that action at this time.
0 commit comments