Skip to content

Commit

Permalink
Merge pull request #10452 from som-snytt/revert/string-constrained
Browse files Browse the repository at this point in the history
Revert aggressive optimization of String lobounds
  • Loading branch information
lrytz committed Jul 3, 2023
2 parents dff5007 + 4fd1878 commit 7c63166
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions src/reflect/scala/reflect/internal/tpe/TypeConstraints.scala
Original file line number Diff line number Diff line change
Expand Up @@ -127,18 +127,12 @@ private[internal] trait TypeConstraints {
case _ => !lobounds.contains(tp)
}
if (mustConsider) {
def justTwoStrings: Boolean = (
tp.typeSymbol == StringClass && tp.isInstanceOf[ConstantType] &&
lobounds.lengthCompare(1) == 0 && lobounds.head.typeSymbol == StringClass
)
if (isNumericBound && isNumericValueType(tp)) {
if (numlo == NoType || isNumericSubType(numlo, tp))
numlo = tp
else if (!isNumericSubType(tp, numlo))
numlo = numericLoBound
}
else if (justTwoStrings)
lobounds = tp.widen :: Nil // don't accumulate strings; we know they are not exactly the same bc mustConsider
else lobounds ::= tp
}
}
Expand Down

0 comments on commit 7c63166

Please sign in to comment.