@@ -113,35 +113,40 @@ trait ClassLikeSupport:
113
113
114
114
if ! isModule then Inkuire .db = Inkuire .db.copy(types = Inkuire .db.types.updated(classType.itid.get, (classType, parents)))
115
115
116
- classDef.symbol.declaredTypes.foreach {
117
- case typeSymbol : Symbol if typeSymbol.flags.is(Flags .Opaque ) =>
118
- val typ = typeSymbol.tree.asInkuire(variableNames)
119
- if typ.isInstanceOf [Inkuire .Type ] then {
120
- val t = typ.asInstanceOf [Inkuire .Type ]
121
- Inkuire .db = Inkuire .db.copy(types = Inkuire .db.types.updated(t.itid.get, (t, Seq .empty)))
122
- }
123
- case typeSymbol : Symbol =>
124
- val typeDef = typeSymbol.tree.asInstanceOf [TypeDef ]
125
- if typeDef.rhs.symbol.flags.is(Flags .JavaDefined ) then
126
- val typ = typeSymbol.tree.asInkuire(variableNames) // TODO [Inkuire] Hack until type aliases are supported
127
- val typJava = typeDef.rhs.symbol.tree.asInkuire(variableNames)
128
- if typ.isInstanceOf [Inkuire .Type ] then { // TODO [Inkuire] Hack until type aliases are supported
116
+ classDef.symbol.declaredTypes
117
+ .filter(viableSymbol)
118
+ .foreach {
119
+ case typeSymbol : Symbol if typeSymbol.flags.is(Flags .Opaque ) =>
120
+ val typ = typeSymbol.tree.asInkuire(variableNames)
121
+ if typ.isInstanceOf [Inkuire .Type ] then {
129
122
val t = typ.asInstanceOf [Inkuire .Type ]
130
123
Inkuire .db = Inkuire .db.copy(types = Inkuire .db.types.updated(t.itid.get, (t, Seq .empty)))
131
124
}
132
- if typJava.isInstanceOf [Inkuire .Type ] then {
133
- val tJava = typJava.asInstanceOf [Inkuire .Type ]
134
- Inkuire .db = Inkuire .db.copy(types = Inkuire .db.types.updated(tJava.itid.get, (tJava, Seq .empty)))
125
+ case typeSymbol : Symbol if ! typeSymbol.isClassDef =>
126
+ val typeDef = typeSymbol.tree.asInstanceOf [TypeDef ]
127
+ val typ = typeSymbol.tree.asInkuire(variableNames)
128
+ if typ.isInstanceOf [Inkuire .Type ] then {
129
+ val t = typ.asInstanceOf [Inkuire .Type ]
130
+ val rhsTypeLike = typeDef.rhs.asInkuire(variableNames)
131
+ Inkuire .db = Inkuire .db.copy(typeAliases = Inkuire .db.typeAliases.updated(t.itid.get, rhsTypeLike))
135
132
}
133
+ if typeDef.rhs.symbol.flags.is(Flags .JavaDefined ) then
134
+ val typJava = typeDef.rhs.asInkuire(variableNames)
135
+ if typJava.isInstanceOf [Inkuire .Type ] then {
136
+ val tJava = typJava.asInstanceOf [Inkuire .Type ]
137
+ Inkuire .db = Inkuire .db.copy(types = Inkuire .db.types.updated(tJava.itid.get, (tJava, Seq .empty)))
138
+ }
139
+ case _ =>
136
140
}
137
141
142
+ def viableSymbol (s : Symbol ): Boolean =
143
+ ! s.flags.is(Flags .Private ) &&
144
+ ! s.flags.is(Flags .Protected ) &&
145
+ ! s.flags.is(Flags .Override ) &&
146
+ ! s.flags.is(Flags .Synthetic )
147
+
138
148
classDef.symbol.declaredMethods
139
- .filter { (s : Symbol ) =>
140
- ! s.flags.is(Flags .Private ) &&
141
- ! s.flags.is(Flags .Protected ) &&
142
- ! s.flags.is(Flags .Override ) &&
143
- ! s.flags.is(Flags .Synthetic )
144
- }
149
+ .filter(viableSymbol)
145
150
.foreach {
146
151
case implicitConversion : Symbol if implicitConversion.flags.is(Flags .Implicit )
147
152
&& classDef.symbol.flags.is(Flags .Module )
0 commit comments