Open sstrickl opened 10 months ago
That is, the fix I'm submitting for that issue checks the value of -Dtest_runner.configuration
to skip the type check that incldues named parameters, after I noticed it still failed when adding @pragma("vm:keep-names")
to the associated function, but it'd be nicer to have the pragma to explicitly mark the parameter names (and function name) as unobfuscated instead of having the test fail if run with an obfuscating VM but not under the test framework.
However, the named parameters of a function are still obfuscated, even if the function is annotated with @pragma("vm:keep-names"), which is reflected when the type of the function is converted to a string for comparison. Is this on purpose, or just not considered when @pragma("vm:keep-name") was added?
The annotation only affects class/function symbol names - it doesn't prevent tree shaking, it doesn't allow calling those symbols as entry points. So there's no obvious reason why the names of named parameters cannot be obfuscated, made mandatory, or even removed.
@sstrickl I guess you are working on this.
When writing tests that check class and function names (e.g., by doing string comparison of runtime types),
@pragma("vm:keep-name")
can be used to annotate those classes and functions so that the names won't be obfuscated when obfuscation is enabled.However, the named parameters of a function are still obfuscated, even if the function is annotated with
@pragma("vm:keep-names")
, which is reflected when the type of the function is converted to a string for comparison. Is this on purpose, or just not considered when@pragma("vm:keep-name")
was added?See https://github.com/dart-lang/sdk/issues/53879 for context.
/cc @alexmarkov @mkustermann