Skip to content

Commit 443a3b0

Browse files
committed
Fix warning about unnecessary GADTused
1 parent 5c987c2 commit 443a3b0

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

compiler/src/dotty/tools/dotc/typer/Typer.scala

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3533,10 +3533,11 @@ class Typer extends Namer
35333533
case CompareResult.OKwithGADTUsed
35343534
if pt.isValueType
35353535
&& !inContext(ctx.fresh.setGadt(EmptyGadtConstraint)) {
3536-
(tree.tpe.widenExpr frozen_<:< pt)
3537-
// we overshot; a cast is not needed, after all. (this happens a lot. We should
3538-
// find out whether we can make GADTused more precise)
3539-
.showing(i"false alarm for $tree: ${tree.tpe.widenExpr} vs $pt in ${ctx.source}", gadts)
3536+
val res = (tree.tpe.widenExpr frozen_<:< pt)
3537+
if res then
3538+
// we overshot; a cast is not needed, after all.
3539+
gadts.println(i"unnecessary GADTused for $tree: ${tree.tpe.widenExpr} vs $pt in ${ctx.source}")
3540+
res
35403541
} =>
35413542
// Insert an explicit cast, so that -Ycheck in later phases succeeds.
35423543
// I suspect, but am not 100% sure that this might affect inferred types,

0 commit comments

Comments
 (0)