File tree 2 files changed +17
-4
lines changed
src/dotty/tools/dotc/core 2 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -167,12 +167,19 @@ 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
- 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
+ }
173
180
case pt => pt
174
181
}
175
- val target = lowerBound (pt).typeSymbol
182
+ val target = classBound (pt).typeSymbol
176
183
if (target == tpe.typeSymbol)
177
184
this
178
185
else if ((target == defn.ByteClass ) && isByteRange)
Original file line number Diff line number Diff line change
1
+ object Test {
2
+
3
+ val a : Char = 98
4
+ val c : (Char , Char ) = ('a' , 98 )
5
+
6
+ }
You can’t perform that action at this time.
0 commit comments