@@ -40,8 +40,7 @@ object PostTyper {
40
40
*
41
41
* (10) Adds Child annotations to all sealed classes
42
42
*
43
- * (11) Minimizes `call` fields of `Inlined` nodes to just point to the toplevel
44
- * class from which code was inlined.
43
+ * (11) Replace RHS of `erased` (but not `inline`) members by `(???: rhs.type)`
45
44
*
46
45
* The reason for making this a macro transform is that some functions (in particular
47
46
* super and protected accessors and instantiation checks) are naturally top-down and
@@ -183,14 +182,6 @@ class PostTyper extends MacroTransform with IdentityDenotTransformer { thisPhase
183
182
ctx.compilationUnit.containsInlineCalls = true
184
183
}
185
184
186
- private object dropInlines extends TreeMap {
187
- override def transform (tree : Tree )(implicit ctx : Context ): Tree = tree match {
188
- case Inlined (call, _, _) =>
189
- cpy.Inlined (tree)(call, Nil , Typed (ref(defn.Predef_undefined ), TypeTree (tree.tpe)))
190
- case _ => super .transform(tree)
191
- }
192
- }
193
-
194
185
override def transform (tree : Tree )(implicit ctx : Context ): Tree =
195
186
try tree match {
196
187
case tree : Ident if ! tree.isType =>
@@ -218,7 +209,7 @@ class PostTyper extends MacroTransform with IdentityDenotTransformer { thisPhase
218
209
tree.fun,
219
210
tree.args.map(arg =>
220
211
if (methType.isImplicitMethod && arg.pos.isSynthetic) ref(defn.Predef_undefined )
221
- else dropInlines.transform( arg) ))
212
+ else arg))
222
213
else
223
214
tree
224
215
methPart(app) match {
@@ -328,9 +319,10 @@ class PostTyper extends MacroTransform with IdentityDenotTransformer { thisPhase
328
319
}
329
320
330
321
/** Transforms the rhs tree into a its default tree if it is in an `erased` val/def.
331
- * Performed to shrink the tree that is known to be erased later.
332
- */
322
+ * Performed to shrink the tree that is known to be erased later.
323
+ */
333
324
private def normalizeErasedRhs (rhs : Tree , sym : Symbol )(implicit ctx : Context ) =
334
- if (sym.isEffectivelyErased) dropInlines.transform(rhs) else rhs
325
+ if (! sym.isEffectivelyErased || sym.isInlineMethod || ! rhs.tpe.exists) rhs
326
+ else Typed (ref(defn.Predef_undefined ), TypeTree (rhs.tpe))
335
327
}
336
328
}
0 commit comments