@@ -13,29 +13,7 @@ trait SymbolTransformer { self =>
13
13
def compose (that : SymbolTransformer { val t : self.s.type }): SymbolTransformer {
14
14
val s : that.s.type
15
15
val t : self.t.type
16
- } = {
17
- /** Enables equality checks between symbol transformer compositions */
18
- class SymbolTransformerComposition (protected val lhs : self.type ,
19
- protected val rhs : that.type )
20
- (override val s : rhs.s.type ,
21
- override val t : self.t.type )
22
- extends SymbolTransformer {
23
-
24
- override def transform (syms : s.Symbols ): t.Symbols = lhs.transform(rhs.transform(syms))
25
-
26
- override def equals (that : Any ): Boolean = that match {
27
- // NOTE: there is a spurious warning saying:
28
- // "the type test for SymbolTransformerComposition cannot be checked at runtime because it's a local class"
29
- // but the type test actually works as expected
30
- case c : SymbolTransformerComposition => rhs == c.rhs && lhs == c.lhs
31
- case _ => false
32
- }
33
-
34
- override def hashCode : Int = 31 * rhs.hashCode + lhs.hashCode
35
- }
36
-
37
- new SymbolTransformerComposition (self, that)(that.s, self.t)
38
- }
16
+ } = SymbolTransformerComposition (self, that)
39
17
40
18
def andThen (that : SymbolTransformer {
41
19
val s : self.t.type
@@ -59,6 +37,36 @@ trait SimpleSymbolTransformer extends SymbolTransformer { self =>
59
37
.withFunctions(syms.functions.values.toSeq.map(transformFunction))
60
38
.withSorts(syms.sorts.values.toSeq.map(transformSort))
61
39
}
40
+
41
+ /** Enables equality checks between symbol transformer compositions */
42
+ class SymbolTransformerComposition (protected val left : SymbolTransformer ,
43
+ protected val right : SymbolTransformer { val t : left.s.type })
44
+ (override val s : right.s.type ,
45
+ override val t : left.t.type )
46
+ extends SymbolTransformer {
47
+
48
+
49
+ override def transform (syms : s.Symbols ): t.Symbols = left.transform(right.transform(syms))
50
+
51
+ override def equals (that : Any ): Boolean = that match {
52
+ // NOTE: there is a spurious warning saying:
53
+ // "the type test for SymbolTransformerComposition cannot be checked at runtime because it's a local class"
54
+ // but the type test actually works as expected
55
+ case c : SymbolTransformerComposition => right == c.right && left == c.left
56
+ case _ => false
57
+ }
58
+
59
+ override def hashCode : Int = 31 * right.hashCode + left.hashCode
60
+ }
61
+
62
+ object SymbolTransformerComposition {
63
+ def apply (left : SymbolTransformer , right : SymbolTransformer {val t : left.s.type }): SymbolTransformer {
64
+ val s : right.s.type
65
+ val t : left.t.type
66
+ } =
67
+ class LocalComposition (lhs : left.type , rhs : right.type , s : right.s.type , t : left.t.type ) extends SymbolTransformerComposition (left, right)(s, t)
68
+ new LocalComposition (left, right, right.s, left.t)
69
+ }
62
70
63
71
object SymbolTransformer {
64
72
def apply (trans : DefinitionTransformer ): SymbolTransformer {
0 commit comments