File tree Expand file tree Collapse file tree 5 files changed +20
-13
lines changed Expand file tree Collapse file tree 5 files changed +20
-13
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import Periods._
5
5
import SymDenotations ._
6
6
import Contexts ._
7
7
import Types ._
8
+ import Symbols ._
8
9
import Denotations ._
9
10
import Phases ._
10
11
import java .lang .AssertionError
@@ -30,4 +31,19 @@ object DenotTransformers {
30
31
/** The transformation method */
31
32
def transform (ref : SingleDenotation )(implicit ctx : Context ): SingleDenotation
32
33
}
34
+
35
+ trait InfoTransformer extends DenotTransformer {
36
+
37
+ def transformInfo (tp : Type , sym : Symbol )(implicit ctx : Context ): Type
38
+
39
+ /** The transformation method */
40
+ def transform (ref : SingleDenotation )(implicit ctx : Context ): SingleDenotation = {
41
+ val info1 = transformInfo(ref.info, ref.symbol)
42
+ if (info1 eq ref.info) ref
43
+ else ref match {
44
+ case ref : SymDenotation => ref.copySymDenotation(info = info1)
45
+ case _ => ref.derivedSingleDenotation(ref.symbol, info1)
46
+ }
47
+ }
48
+ }
33
49
}
Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ package dotty.tools.dotc
2
2
package transform
3
3
4
4
import TreeTransforms ._
5
- import core .DenotTransformers ._
6
5
import core .Denotations ._
7
6
import core .SymDenotations ._
8
7
import core .Contexts ._
@@ -27,7 +26,6 @@ import dotty.runtime.LazyVals
27
26
import scala .collection .mutable .ListBuffer
28
27
import dotty .tools .dotc .core .Denotations .SingleDenotation
29
28
import dotty .tools .dotc .core .SymDenotations .SymDenotation
30
- import dotty .tools .dotc .core .DenotTransformers .DenotTransformer
31
29
import StdNames ._
32
30
33
31
/** Replace member references as follows:
Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ package dotty.tools.dotc
2
2
package transform
3
3
4
4
import TreeTransforms ._
5
- import core .DenotTransformers ._
6
5
import core .Denotations ._
7
6
import core .SymDenotations ._
8
7
import core .Contexts ._
Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ package dotty.tools.dotc
2
2
package transform
3
3
4
4
import TreeTransforms ._
5
- import core .DenotTransformers ._
6
5
import core .Denotations ._
7
6
import core .SymDenotations ._
8
7
import core .Contexts ._
Original file line number Diff line number Diff line change @@ -7,10 +7,11 @@ import core.Denotations._
7
7
import core .SymDenotations ._
8
8
import core .Contexts ._
9
9
import core .Types ._
10
+ import core .Symbols ._
10
11
import ast .Trees ._
11
12
import ast .tpd .{Apply , Tree , cpy }
12
13
13
- class UncurryTreeTransform extends TreeTransform with DenotTransformer {
14
+ class UncurryTreeTransform extends TreeTransform with InfoTransformer {
14
15
15
16
override def name : String = " uncurry"
16
17
override def transformApply (tree : Apply )(implicit ctx : Context , info : TransformerInfo ): Tree =
@@ -40,12 +41,6 @@ class UncurryTreeTransform extends TreeTransform with DenotTransformer {
40
41
tp
41
42
}
42
43
43
- def transform (ref : SingleDenotation )(implicit ctx : Context ): SingleDenotation = {
44
- val info1 = uncurry(ref.info)
45
- if (info1 eq ref.info) ref
46
- else ref match {
47
- case ref : SymDenotation => ref.copySymDenotation(info = info1)
48
- case _ => ref.derivedSingleDenotation(ref.symbol, info1)
49
- }
50
- }
44
+ def transformInfo (tp : Type , sym : Symbol )(implicit ctx : Context ): Type =
45
+ uncurry(tp)
51
46
}
You can’t perform that action at this time.
0 commit comments