Skip to content

Commit b677f97

Browse files
committed
More careful ClassTag instantiation
We now use a blend of the new scheme and backwards compatible special case if type variables as ClassTag arguments are constrained by further type variables. Fixes #23611
1 parent 53bea78 commit b677f97

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5117,11 +5117,17 @@ object Types extends TypeUtils {
51175117
*/
51185118
private def currentEntry(using Context): Type = ctx.typerState.constraint.entry(origin)
51195119

5120+
/** For uninstantiated type variables: the lower bound */
5121+
def lowerBound(using Context): Type = currentEntry.loBound
5122+
5123+
/** For uninstantiated type variables: the upper bound */
5124+
def upperBound(using Context): Type = currentEntry.hiBound
5125+
51205126
/** For uninstantiated type variables: Is the lower bound different from Nothing? */
5121-
def hasLowerBound(using Context): Boolean = !currentEntry.loBound.isExactlyNothing
5127+
def hasLowerBound(using Context): Boolean = !lowerBound.isExactlyNothing
51225128

51235129
/** For uninstantiated type variables: Is the upper bound different from Any? */
5124-
def hasUpperBound(using Context): Boolean = !currentEntry.hiBound.isTopOfSomeKind
5130+
def hasUpperBound(using Context): Boolean = !upperBound.isTopOfSomeKind
51255131

51265132
/** Unwrap to instance (if instantiated) or origin (if not), until result
51275133
* is no longer a TypeVar

0 commit comments

Comments
 (0)