Skip to content

Commit d5fab3c

Browse files
committed
Get type bounds from gadt
1 parent 0701fd0 commit d5fab3c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

compiler/src/dotty/tools/dotc/typer/QuotesAndSplices.scala

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,14 +391,19 @@ object QuotesAndSplices {
391391
*/
392392
def apply(typeargs: List[Type], args: List[Type], resultType: Type)(using Context): Type =
393393
val typeargs1 = PolyType.syntheticParamNames(typeargs.length)
394-
val paraminfosExp = (_: PolyType) => typeargs map (_.bounds)
394+
val bounds = typeargs map { tpe =>
395+
ctx.gadt.fullBounds(tpe.typeSymbol) match
396+
case b:TypeBounds => b
397+
case _ => TypeBounds.empty
398+
}
399+
println(s"bounds = ${bounds map (_.show)}")
395400
val resultTypeExp = (pt: PolyType) => {
396401
val fromSymbols = typeargs map (_.typeSymbol)
397402
val args1 = args map (_.subst(fromSymbols, pt.paramRefs))
398403
val resultType1 = resultType.subst(fromSymbols, pt.paramRefs)
399404
MethodType(args1, resultType)
400405
}
401-
val tpe = PolyType(typeargs1)(paraminfosExp, resultTypeExp)
406+
val tpe = PolyType(typeargs1)(_ => bounds, resultTypeExp)
402407
RefinedType(defn.PolyFunctionType, nme.apply, tpe)
403408
}
404409
}

0 commit comments

Comments
 (0)