Skip to content

Commit da5b035

Browse files
committed
do not widen if the parameter is precise or the mode is Precise
1 parent 4ccc7d8 commit da5b035

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

compiler/src/dotty/tools/dotc/core/ConstraintHandling.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,8 @@ trait ConstraintHandling {
647647
case _ => isSubTypeWhenFrozen(tp, defn.SingletonType)
648648

649649
val wideInst =
650-
if isSingleton(bound) then inst
650+
//keeping the precise type if the bound is Singleton or precise or the mode is precise
651+
if isSingleton(bound) || ctx.mode.is(Mode.Precise) || bound.isPrecise then inst
651652
else dropTransparentTraits(widenIrreducible(widenOr(widenSingle(inst))), bound)
652653
wideInst match
653654
case wideInst: TypeRef if wideInst.symbol.is(Module) =>

0 commit comments

Comments
 (0)