@@ -67,27 +67,38 @@ import transform.SymUtils._
67
67
def collectTypeTests (t : Tree )(implicit ctx : Context ): List [(Symbol , Type )] = {
68
68
def recur (t : Tree ): List [(Symbol , Type )] =
69
69
t match {
70
- case Apply (x, _) if (x.symbol == defn.Boolean_! || x.symbol == defn.Boolean_|| ) => List .empty
71
- case Apply (fun @ Select (x, _), y) if (fun.symbol == defn.Boolean_&& ) => recur(x) ++ recur(y.head)
72
- case TypeApply (fun @ Select (x, _), List (tp)) if fun.symbol eq defn.Any_isInstanceOf =>
73
- if (x.symbol.exists && ! x.symbol.owner.isClass && ! x.symbol.is(Method | Mutable ))
74
- (x.symbol, tp.tpe) :: Nil
75
- else Nil
76
- case _ => List .empty
70
+ case Apply (x, _) if (x.symbol == defn.Boolean_! || x.symbol == defn.Boolean_|| ) =>
71
+ Nil
72
+
73
+ case Apply (fun @ Select (x, _), y) if (fun.symbol == defn.Boolean_&& ) =>
74
+ recur(x) ++ recur(y.head)
75
+
76
+ case TypeApply (fun @ Select (x, _), List (tp))
77
+ if fun.symbol.eq(defn.Any_isInstanceOf ) &&
78
+ ! x.symbol.is(Method | Mutable ) &&
79
+ x.symbol.exists && ! x.symbol.owner.isClass =>
80
+ (x.symbol, tp.tpe) :: Nil
81
+
82
+ case _ => Nil
77
83
}
78
84
recur(t)
79
85
}
80
86
81
87
def collectNullTests (t : Tree )(implicit ctx : Context ): List [Symbol ] = {
82
88
def recur (t : Tree ): List [Symbol ] =
83
89
t match {
84
- case Apply (x, _) if (x.symbol == defn.Boolean_! || x.symbol == defn.Boolean_|| ) => List .empty
85
- case Apply (fun @ Select (x, _), y) if (fun.symbol == defn.Boolean_&& ) => recur(x) ++ recur(y.head)
86
- case Apply (fun @ Select (x, _), List (tp)) if fun.symbol eq defn.Object_ne =>
87
- if (x.symbol.exists && ! x.symbol.owner.isClass && ! x.symbol.is(Method | Mutable ))
88
- x.symbol :: Nil
89
- else Nil
90
- case _ => List .empty
90
+ case Apply (x, _) if (x.symbol == defn.Boolean_! || x.symbol == defn.Boolean_|| ) => Nil
91
+
92
+ case Apply (fun @ Select (x, _), y) if (fun.symbol == defn.Boolean_&& ) =>
93
+ recur(x) ++ recur(y.head)
94
+
95
+ case Apply (fun @ Select (x, _), List (tp))
96
+ if fun.symbol.eq(defn.Object_ne ) &&
97
+ ! x.symbol.is(Method | Mutable ) &&
98
+ x.symbol.exists && ! x.symbol.owner.isClass =>
99
+ x.symbol :: Nil
100
+
101
+ case _ => Nil
91
102
}
92
103
recur(t)
93
104
}
0 commit comments