@@ -96,15 +96,6 @@ object Inliner:
9696 }
9797 end isElideableExpr
9898
99- // InlineCopier is a more fault-tolerant copier that does not cause errors when
100- // function types in applications are undefined. This is necessary since we copy at
101- // the same time as establishing the proper context in which the copied tree should
102- // be evaluated. This matters for opaque types, see neg/i14653.scala.
103- private class InlineCopier () extends TypedTreeCopier :
104- override def Apply (tree : Tree )(fun : Tree , args : List [Tree ])(using Context ): Apply =
105- if fun.tpe.widen.exists then super .Apply (tree)(fun, args)
106- else untpd.cpy.Apply (tree)(fun, args).withTypeUnchecked(tree.tpe)
107-
10899 // InlinerMap is a TreeTypeMap with special treatment for inlined arguments:
109100 // They are generally left alone (not mapped further, and if they wrap a type
110101 // the type Inlined wrapper gets dropped
@@ -116,7 +107,13 @@ object Inliner:
116107 substFrom : List [Symbol ],
117108 substTo : List [Symbol ])(using Context )
118109 extends TreeTypeMap (
119- typeMap, treeMap, oldOwners, newOwners, substFrom, substTo, InlineCopier ()):
110+ typeMap, treeMap, oldOwners, newOwners, substFrom, substTo,
111+ // It is necessary to use the `ConservativeTreeCopier` since we copy at
112+ // the same time as establishing the proper context in which the copied
113+ // tree should be evaluated. This matters for opaque types, see
114+ // neg/i14653.scala.
115+ ConservativeTreeCopier ()
116+ ):
120117
121118 override def copy (
122119 typeMap : Type => Type ,
0 commit comments