@@ -18,7 +18,7 @@ trait InkuireSupport:
1818 private given qctx .type = qctx
1919
2020 private def paramsForClass (classDef : ClassDef , vars : Set [String ]): Seq [Inkuire .Variance ] =
21- classDef.getTypeParams.map(mkTypeArgumentInkuire(_, vars) )
21+ classDef.getTypeParams.map(mkTypeArgumentInkuire)
2222
2323 given TreeSyntaxInkuire : AnyRef with
2424 extension (tpeTree : Tree )
@@ -58,19 +58,28 @@ trait InkuireSupport:
5858 extension (tpe : TypeRepr )
5959 def asInkuire (vars : Set [String ]): Inkuire .Type = inner(tpe, vars)
6060
61- def mkTypeArgumentInkuire (argument : TypeDef , vars : Set [String ] = Set .empty): Inkuire .Variance =
61+ def mkTypeArgumentInkuire (argument : TypeDef ): Inkuire .Variance =
62+ // TODO [Inkuire] Type bounds (other than just HKTs)
6263 val name = argument.symbol.normalizedName
6364 val normalizedName = if name.matches(" _\\ $\\ d*" ) then " _" else name
65+ val params = 1 .to(typeVariableDeclarationParamsNo(argument)).map(_ => Inkuire .Type .StarProjection )
6466 val t = Inkuire .Type (
6567 name = Inkuire .TypeName (normalizedName),
6668 itid = argument.symbol.itid,
6769 isVariable = true ,
68- params = Seq .empty // TODO [ Inkuire] Type Lambdas
70+ params = params.map( Inkuire . Invariance (_))
6971 )
7072 if argument.symbol.flags.is(Flags .Covariant ) then Inkuire .Covariance (t)
7173 else if argument.symbol.flags.is(Flags .Contravariant ) then Inkuire .Contravariance (t)
7274 else Inkuire .Invariance (t)
7375
76+ def typeVariableDeclarationParamsNo (argument : TypeDef ): Int =
77+ argument.rhs match
78+ case t : TypeTree => t.tpe match
79+ case TypeBounds (_, TypeLambda (names, _, _)) => names.size
80+ case _ => 0
81+ case _ => 0
82+
7483 private def isRepeatedAnnotation (term : Term ) =
7584 term.tpe match
7685 case t : TypeRef => t.name == " Repeated" && t.qualifier.match
0 commit comments