Skip to content

Commit fb25987

Browse files
committed
Make error handling readable
1 parent de0f6a3 commit fb25987

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

scaladoc/src/dotty/tools/scaladoc/tasty/ClassLikeSupport.scala

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -115,21 +115,24 @@ trait ClassLikeSupport:
115115

116116
classDef.symbol.declaredTypes.foreach {
117117
case typeSymbol: Symbol if typeSymbol.flags.is(Flags.Opaque) =>
118-
val t = typeSymbol.tree.asInkuire(variableNames)
119-
t match
120-
case t: Inkuire.Type => Inkuire.db = Inkuire.db.copy(types = Inkuire.db.types.updated(t.itid.get, (t, Seq.empty)))
121-
case _ =>
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+
}
122123
case typeSymbol: Symbol =>
123124
val typeDef = typeSymbol.tree.asInstanceOf[TypeDef]
124125
if typeDef.rhs.symbol.flags.is(Flags.JavaDefined) then
125-
val t = typeSymbol.tree.asInkuire(variableNames) // TODO [Inkuire] Hack until type aliases are supported
126-
val tJava = typeDef.rhs.symbol.tree.asInkuire(variableNames)
127-
t match
128-
case t: Inkuire.Type => Inkuire.db = Inkuire.db.copy(types = Inkuire.db.types.updated(t.itid.get, (t, Seq.empty))) // TODO [Inkuire] Hack until type aliases are supported
129-
case _ =>
130-
tJava match
131-
case tJava: Inkuire.Type => Inkuire.db = Inkuire.db.copy(types = Inkuire.db.types.updated(tJava.itid.get, (tJava, Seq.empty)))
132-
case _ =>
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
129+
val t = typ.asInstanceOf[Inkuire.Type]
130+
Inkuire.db = Inkuire.db.copy(types = Inkuire.db.types.updated(t.itid.get, (t, Seq.empty)))
131+
}
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)))
135+
}
133136
}
134137

135138
classDef.symbol.declaredMethods

0 commit comments

Comments
 (0)