Skip to content

Commit c489415

Browse files
committed
Warn if unexpected type appear while converting type to SemanticDB type
1 parent 5f9ce74 commit c489415

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,14 @@ class TypeOps:
5151
}
5252

5353
private def symbolNotFound(binder: Type, name: Name, parent: Symbol)(using ctx: Context): Unit =
54+
warn(s"Ignoring ${name} of symbol ${parent}, type ${binder}")
55+
56+
private def unexpectedType(parent: Symbol, tpe: Type)(using Context): Unit =
57+
warn(s"Unexpected type ${tpe} of symbol ${parent}")
58+
59+
private def warn(msg: String)(using ctx: Context): Unit =
5460
report.warning(
55-
s"""Internal error in extracting SemanticDB while compiling ${ctx.compilationUnit.source}: Ignoring ${name} of symbol ${parent}, type ${binder}"""
61+
s"Internal error in extracting SemanticDB while compiling ${ctx.compilationUnit.source}: ${msg}"
5662
)
5763

5864
extension (tpe: Type)
@@ -361,7 +367,15 @@ class TypeOps:
361367
case NoPrefix =>
362368
s.Type.Empty
363369

364-
case _ => s.Type.Empty
370+
// Not yet supported
371+
case _: HKTypeLambda =>
372+
s.Type.Empty
373+
case _: MatchType =>
374+
s.Type.Empty
375+
376+
case other =>
377+
unexpectedType(sym, other)
378+
s.Type.Empty
365379
}
366380
loop(tpe)
367381

0 commit comments

Comments
 (0)