Open davidmorgan opened 6 months ago
Simplest things I could think of with mockito, mocking a macro-added field and a macro-added type, both seem to work without changes
https://github.com/dart-lang/mockito/compare/master...davidmorgan:mockito:built-with-macros
although I did hit an issue with "asset" paths that I'll report over in the "build" repo, and an issue with augmenting a class that generics that I guess I'll add a language test for.
Perhaps this is not a question about language specification documents, but rather about the behavior of code generators? In that case we might consider area-tools
rather than area-specification
.
Yes, it's not spec related. It's about the effect of macro implementation details on existing code generators ... actually that specifically means the analyzer API, I'll tag it with that. Thanks.
A related issue to this one is build performance of generators + macros.
There are cases where external use of generators is pushing the limits of performance, one is mentioned here https://github.com/dart-lang/language/issues/314#issuecomment-2009522428 and another is here https://github.com/google/built_value.dart/issues/1288
It would be useful to know what happens to these with macros thrown into the mix: is there a viable path to macros that goes via some mix of macros and generators, or is that going to be too slow, and they'll have to switch to macros in one shot?
I noticed in the analyzer's element.dart that there are deprecations pointing to "augmented" getters that give the merged information with augmentations, e.g.:
@Deprecated('Use `element.augmented.lookUpMethod`.')
MethodElement? lookUpMethod(String methodName, LibraryElement library);
So this is another type of updates generators will need if they should interact with augmentations as if they are pre-augmentation code.
Macros will introduce augmentation libraries; what changes are needed to widely-used generators so that they continue to work?
The analyzer exposes new API that will need to be used in some cases, see e.g. mentions of "augmentation" in package:analyzer/dart/element/element.dart.