File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
src/dotty/tools/dotc/core Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -167,10 +167,15 @@ object Constants {
167
167
/** Convert constant value to conform to given type.
168
168
*/
169
169
def convertTo (pt : Type )(implicit ctx : Context ): Constant = {
170
- val target = pt.typeSymbol
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.typeComparer.bounds(param).lo)
173
+ case pt => pt
174
+ }
175
+ val target = lowerBound(pt).typeSymbol
171
176
if (target == tpe.typeSymbol)
172
177
this
173
- else if (target == defn.ByteClass && isByteRange)
178
+ else if (( target == defn.ByteClass ) && isByteRange)
174
179
Constant (byteValue)
175
180
else if (target == defn.ShortClass && isShortRange)
176
181
Constant (shortValue)
You can’t perform that action at this time.
0 commit comments