Skip to content

Commit 61d0073

Browse files
oderskyWojciechMazur
authored andcommitted
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 [Cherry-picked b677f97]
1 parent 946ad71 commit 61d0073

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
@@ -5116,11 +5116,17 @@ object Types extends TypeUtils {
51165116
*/
51175117
private def currentEntry(using Context): Type = ctx.typerState.constraint.entry(origin)
51185118

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

51225128
/** For uninstantiated type variables: Is the upper bound different from Any? */
5123-
def hasUpperBound(using Context): Boolean = !currentEntry.hiBound.isTopOfSomeKind
5129+
def hasUpperBound(using Context): Boolean = !upperBound.isTopOfSomeKind
51245130

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

0 commit comments

Comments
 (0)