Skip to content

BeanInfoDigger cannot handle FlexibleTypes #51

Description

@HarrisL2

Issue summarized from a run of the Scala Open Community Build

When compiling this project with -Yexplicit-nulls enabled, the project fails with the following message:

java.lang.RuntimeException: Unspported type :FlexibleType(OrType(TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class java)),object lang),class String),TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Null)),TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class java)),object lang),class String))

The cause is from

def resolveType(typeRepr: TypeRepr, params: Map[String, TypeRepr]): Expr[AnyRef] = {
var tpe = typeRepr
var args: List[Expr[AnyRef]] = List.empty
tpe match {
case d: TypeRef => if (tpe.typeSymbol.flags.is(Flags.Param) && params.contains(tpe.typeSymbol.name)) tpe = params(tpe.typeSymbol.name)
case c: AppliedType => args = resolveParamTypes(c, params)
case d: AnnotatedType => tpe = d.underlying
case c: ConstantType =>
case n: OrType =>
case _ => throw new RuntimeException("Unspported type :" + tpe)
}
if args.isEmpty then typeOf(tpe)
else '{ Array(${ typeOf(tpe) }, Array(${ Varargs(args) }: _*)) }
}
where FlexibleTypes are not handled.

The fix is to add a corresponding case to the match and recurse on the underlying type. This might require a minor refactor.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions