-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
137 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
t9414.scala:6: error: could not optimize @tailrec annotated method bar: it is neither private nor final so can be overridden | ||
@tailrec def bar: Int = { | ||
^ | ||
t9414.scala:20: error: could not optimize @tailrec annotated method bar: it is neither private nor final so can be overridden | ||
@tailrec def bar: Int = { | ||
^ | ||
t9414.scala:34: error: could not optimize @tailrec annotated method bar: it is neither private nor final so can be overridden | ||
@tailrec def bar: Int = { | ||
^ | ||
3 errors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import annotation._ | ||
|
||
class C { | ||
def foo = { | ||
class Parent { | ||
@tailrec def bar: Int = { | ||
println("here we go again") | ||
bar | ||
} | ||
} | ||
class Child extends Parent { | ||
override def bar = 42 | ||
} | ||
} | ||
} | ||
|
||
class D { | ||
def foo = { | ||
class Parent { | ||
@tailrec def bar: Int = { | ||
println("here we go again") | ||
bar | ||
} | ||
} | ||
class Child extends Parent | ||
class GrandChild extends Child { | ||
override def bar = 42 | ||
} | ||
} | ||
} | ||
|
||
object E { | ||
sealed class Parent { | ||
@tailrec def bar: Int = { | ||
println("here we go again") | ||
bar | ||
} | ||
} | ||
final class Child extends Parent { | ||
override def bar = 42 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import annotation._ | ||
|
||
class C { | ||
def foo = { | ||
class Parent { | ||
@tailrec def bar: Int = { | ||
println("here we go again") | ||
bar | ||
} | ||
} | ||
class Child extends Parent { | ||
def notBar = 42 | ||
} | ||
} | ||
} | ||
|
||
class D { | ||
def foo = { | ||
class Parent { | ||
@tailrec def bar: Int = { | ||
println("here we go again") | ||
bar | ||
} | ||
} | ||
class Child extends Parent | ||
class GrandChild extends Child { | ||
def notBar = 42 | ||
} | ||
} | ||
} | ||
|
||
object E { | ||
sealed class Parent { | ||
@tailrec def bar: Int = { | ||
println("here we go again") | ||
bar | ||
} | ||
} | ||
final class Child extends Parent { | ||
def notBar = 42 | ||
} | ||
} | ||
|
||
class F { | ||
def foo = { | ||
class Parent { | ||
@tailrec def bar: Int = { | ||
println("here we go again") | ||
bar | ||
} | ||
} | ||
class K { | ||
class Child extends Parent { | ||
def notBar = 42 | ||
} | ||
class GrandChild extends Child { | ||
def neitherBar = 42 | ||
} | ||
} | ||
} | ||
} | ||
|
||
class G { | ||
sealed class Parent { | ||
@tailrec def bar: Int = { | ||
println("here we go again") | ||
bar | ||
} | ||
} | ||
def foo = { | ||
class Child extends Parent { | ||
def notBar = 42 | ||
} | ||
class GrandChild extends Child { | ||
def neitherBar = 42 | ||
} | ||
} | ||
} |