@@ -34,7 +34,7 @@ import SymUtils._
34
34
* This is different from the implementation of value classes in Scala 2
35
35
* (see SIP-15) which uses `asInstanceOf` which does not typecheck.
36
36
*
37
- * Finally, if the constructor of a value class is private pr protected
37
+ * Finally, if the constructor of a value class is private or protected
38
38
* it is widened to public.
39
39
*/
40
40
class ExtensionMethods extends MiniPhase with DenotTransformer with FullParameterization { thisPhase =>
@@ -47,6 +47,7 @@ class ExtensionMethods extends MiniPhase with DenotTransformer with FullParamete
47
47
48
48
override def runsAfter = Set (
49
49
ElimRepeated .name,
50
+ TailRec .name, // if ran before, tailrec reports spurious errors (original method is not tailrec anymore)
50
51
ProtectedAccessors .name // protected accessors cannot handle code that is moved from class to companion object
51
52
)
52
53
@@ -111,12 +112,7 @@ class ExtensionMethods extends MiniPhase with DenotTransformer with FullParamete
111
112
moduleClassSym
112
113
}
113
114
case ref : SymDenotation =>
114
- if (isMethodWithExtension(ref.symbol) && ref.hasAnnotation(defn.TailrecAnnot )) {
115
- val ref1 = ref.copySymDenotation()
116
- ref1.removeAnnotation(defn.TailrecAnnot )
117
- ref1
118
- }
119
- else if (ref.isConstructor && isDerivedValueClass(ref.owner) && ref.is(AccessFlags )) {
115
+ if (ref.isConstructor && isDerivedValueClass(ref.owner) && ref.is(AccessFlags )) {
120
116
val ref1 = ref.copySymDenotation()
121
117
ref1.resetFlag(AccessFlags )
122
118
ref1
@@ -137,8 +133,7 @@ class ExtensionMethods extends MiniPhase with DenotTransformer with FullParamete
137
133
(imeth.flags | Final ) &~ (Override | Protected | AbsOverride ),
138
134
fullyParameterizedType(imeth.info, imeth.owner.asClass),
139
135
privateWithin = imeth.privateWithin, coord = imeth.coord)
140
- extensionMeth.addAnnotations(imeth.annotations)(ctx.withPhase(thisPhase))
141
- // need to change phase to add tailrec annotation which gets removed from original method in the same phase.
136
+ extensionMeth.addAnnotations(imeth.annotations)
142
137
extensionMeth
143
138
}
144
139
0 commit comments