File tree Expand file tree Collapse file tree 2 files changed +38
-3
lines changed
src/reflect/scala/reflect/internal Expand file tree Collapse file tree 2 files changed +38
-3
lines changed Original file line number Diff line number Diff line change @@ -1025,14 +1025,13 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
1025
1025
)
1026
1026
/** Is this symbol effectively final or a concrete term member of sealed class whose children do not override it */
1027
1027
final def isEffectivelyFinalOrNotOverridden : Boolean = {
1028
- def hasLocalOwner (c : Symbol ) = { val k = c.originalOwner; k != NoSymbol && k.isTerm }
1029
1028
def isNotOverriddenAt (c : Symbol , hasLocalOwner : Boolean ): Boolean = {
1030
- def checkOverrideIn (sc : Symbol ) = overridingSymbol(sc) == NoSymbol && isNotOverriddenAt(sc, hasLocalOwner)
1029
+ def checkOverrideIn (sc : Symbol ) = overridingSymbol(sc) == NoSymbol && isNotOverriddenAt(sc, hasLocalOwner || sc.originalOwner.isTerm )
1031
1030
c.isClass && (c.isEffectivelyFinal || {
1032
1031
(c.isSealed || hasLocalOwner) && c.children.forall(checkOverrideIn)
1033
1032
})
1034
1033
}
1035
- isEffectivelyFinal || isTerm && ! isDeferred && isNotOverriddenAt(owner, hasLocalOwner( originalOwner) )
1034
+ isEffectivelyFinal || isTerm && ! isDeferred && isNotOverriddenAt(owner, owner. originalOwner.isTerm )
1036
1035
}
1037
1036
1038
1037
/** Is this symbol owned by a package? */
Original file line number Diff line number Diff line change @@ -40,3 +40,39 @@ object E {
40
40
def notBar = 42
41
41
}
42
42
}
43
+
44
+ class F {
45
+ def foo = {
46
+ class Parent {
47
+ @ tailrec def bar : Int = {
48
+ println(" here we go again" )
49
+ bar
50
+ }
51
+ }
52
+ class K {
53
+ class Child extends Parent {
54
+ def notBar = 42
55
+ }
56
+ class GrandChild extends Child {
57
+ def neitherBar = 42
58
+ }
59
+ }
60
+ }
61
+ }
62
+
63
+ class G {
64
+ sealed class Parent {
65
+ @ tailrec def bar : Int = {
66
+ println(" here we go again" )
67
+ bar
68
+ }
69
+ }
70
+ def foo = {
71
+ class Child extends Parent {
72
+ def notBar = 42
73
+ }
74
+ class GrandChild extends Child {
75
+ def neitherBar = 42
76
+ }
77
+ }
78
+ }
You can’t perform that action at this time.
0 commit comments