@@ -45,10 +45,11 @@ import collection.mutable
45
45
* `qual` refers to a method `m` is rewritten to a reference to `m$direct`,
46
46
* keeping the same type and value arguments as they are found in `qual`.
47
47
*
48
- * Note: The phase adds direct methods for all defined methods with IFT results,
49
- * as well as for all methods that are referenced. It does NOT do an
48
+ * Note: The phase adds direct methods for all methods with IFT results that
49
+ * are defined in the transformed compilation unit, as well as for all
50
+ * methods that are referenced from inside the unit. It does NOT do an
50
51
* info transformer that adds these methods everywhere where an IFT returning
51
- * method exists.
52
+ * method exists (including in separately compiled classes) .
52
53
* Adding such an info transformer is impractical because it would mean
53
54
* that we have to force the types of all members of classes that are referenced.
54
55
* But not adding an info transformer can lead to inconsistencies in RefChecks.
@@ -95,12 +96,8 @@ class ShortcutImplicits extends MiniPhase with IdentityDenotTransformer { thisPh
95
96
case TypeApply (fn, args) => cpy.TypeApply (tree)(directQual(fn), args)
96
97
case Block (stats, expr) => cpy.Block (tree)(stats, directQual(expr))
97
98
case tree : RefTree =>
98
- def rewire (tp : Type , sym : Symbol ) = tp match {
99
- case tp : NamedType => tp.prefix.select(sym)
100
- case _ => sym.termRef
101
- }
102
99
cpy.Ref (tree)(DirectMethodName (tree.name.asTermName))
103
- .withType(rewire( tree.tpe, directMethod(tree.symbol)))
100
+ .withType(tree.tpe. asInstanceOf [ NamedType ].prefix.select( directMethod(tree.symbol)))
104
101
}
105
102
directQual(tree.qualifier)
106
103
} else tree
0 commit comments