Fixed
Details
Assignee
UnassignedUnassignedReporter
David MillerDavid MillerPriority
Minor
Details
Details
Assignee
Unassigned
UnassignedReporter
David Miller
David MillerPriority
Created November 29, 2022 at 11:06 PM
Updated November 30, 2022 at 1:03 AM
Resolved November 30, 2022 at 1:03 AM
Because the type
RuntimeType
is not public, when constants of this type, such asSystem.Int64
encountered in Clojure source code, are not recognized as being typed, and hence have an inferred type of the defaultSystem.Object
, leading to unnecessary reflection warnings.An example is:
(System.Array/CreateInstance Int64 (int 5))
The
Int64
will not be seen as being of typeSystem.Type
and we will not be able to resolve the call.In the compiler, the
Int64
becomes aConstantExpr
in the AST. The current definition ofConstantExpr.HasClrType
is just_v.GetType().IsPublic
where _v is the constant in question. When you callGetType
on something likeSystem.Int64
, you get backSystem.RuntimeType
, which is not public. Hence, this constant is seen to have no defined type and hence is defaultly taken as aSystem.Object
.This is typically on a problem when calling
.GetType()
on aSystem.Type
value. Special casing this inConstExpr.HasClrType
andConstExpr.ClrType
will take care of this.