You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Source-gen emits typeof(dynamic) for dynamic test parameters (CS1962) #7165
A test method with a dynamic parameter does not compile in source-gen mode. The generated parameter metadata uses typeof(dynamic), which is error CS1962 ("The typeof operator cannot be used on the dynamic type"):
MyTests_OverloadTests__TestSource.g.cs(528,64): error CS1962: The typeof operator cannot be used on the dynamic type
global::TUnit.Core.ParameterMetadataFactory.Create(typeof(dynamic), "value", new global::TUnit.Core.ConcreteType(typeof(dynamic)), false)
Build with the source generator enabled (the default). Found while checking a review finding on #7148 (OmittedOptionalOverloadCompilationTests with a dynamic parameter).
Expected
dynamic is object at runtime, so the generator should emit typeof(object) wherever it writes typeof(<parameter type>) (parameter metadata, ConcreteType, and anywhere else a type is rendered inside typeof). Reflection mode already sees object for these parameters.
Activity
fix(sourcegen): pass dynamic optional defaults as object
test(sourcegen): snapshot dynamic rendering and fail the compile chec…
fix(sourcegen): render top-level dynamic as object so typeof compiles (…
fix(sourcegen): pass omitted optional defaults so calls bind to the t…