File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed
compiler/src/dotty/tools/dotc/transform Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -45,17 +45,26 @@ import reporting.diagnostic.messages.SuperCallsNotAllowedInline
45
45
* (11) Minimizes `call` fields of `Inline` nodes to just point to the toplevel
46
46
* class from which code was inlined.
47
47
*
48
+ * (12) Converts GADT bounds into normal type bounds
49
+ *
48
50
* The reason for making this a macro transform is that some functions (in particular
49
51
* super and protected accessors and instantiation checks) are naturally top-down and
50
52
* don't lend themselves to the bottom-up approach of a mini phase. The other two functions
51
53
* (forwarding param accessors and synthetic methods) only apply to templates and fit
52
54
* mini-phase or subfunction of a macro phase equally well. But taken by themselves
53
55
* they do not warrant their own group of miniphases before pickling.
54
56
*/
55
- class PostTyper extends MacroTransform with IdentityDenotTransformer { thisTransformer =>
57
+ class PostTyper extends MacroTransform with SymTransformer { thisTransformer =>
58
+
56
59
57
60
import tpd ._
58
61
62
+ def transformSym (ref : SymDenotation )(implicit ctx : Context ): SymDenotation = {
63
+ if (ref.is(BindDefinedType ) && ctx.gadt.bounds.contains(ref.symbol)) {
64
+ ref.copySymDenotation(info = ctx.gadt.bounds.apply(ref.symbol) & ref.info)
65
+ } else ref
66
+ }
67
+
59
68
/** the following two members override abstract members in Transform */
60
69
override def phaseName : String = " posttyper"
61
70
Original file line number Diff line number Diff line change
1
+ trait Map2 [K ] {
2
+ def get (k : K ): K = k
3
+ def foo : K = {
4
+ this match {
5
+ case that : Map2 [b] => that.get(3 .asInstanceOf [b])
6
+ // case that: Map2[c] => that.get(4.asInstanceOf[K])
7
+ case _ => get(5 .asInstanceOf [K ])
8
+ }
9
+ }
10
+ }
You can’t perform that action at this time.
0 commit comments