File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
src/dotty/tools/dotc/core Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -167,12 +167,19 @@ object Constants {
167167 /** Convert constant value to conform to given type.
168168 */
169169 def convertTo (pt : Type )(implicit ctx : Context ): Constant = {
170- def lowerBound (pt : Type ): Type = pt.dealias.stripTypeVar match {
171- case tref : TypeRef if ! tref.symbol.isClass => lowerBound(tref.info.bounds.lo)
172- case param : PolyParam => lowerBound(ctx.typerState.constraint.nonParamBounds(param).lo)
170+ def classBound (pt : Type ): Type = pt.dealias.stripTypeVar match {
171+ case tref : TypeRef if ! tref.symbol.isClass => classBound(tref.info.bounds.lo)
172+ case param : PolyParam =>
173+ ctx.typerState.constraint.entry(param) match {
174+ case TypeBounds (lo, hi) =>
175+ if (hi.classSymbol.isPrimitiveValueClass) hi // constrain further with high bound
176+ else lo
177+ case NoType => param.binder.paramBounds(param.paramNum).lo
178+ case inst => classBound(inst)
179+ }
173180 case pt => pt
174181 }
175- val target = lowerBound (pt).typeSymbol
182+ val target = classBound (pt).typeSymbol
176183 if (target == tpe.typeSymbol)
177184 this
178185 else if ((target == defn.ByteClass ) && isByteRange)
You can’t perform that action at this time.
0 commit comments