google / reflectable.dart

Reflectable is a Dart library that allows programmers to eliminate certain usages of dynamic reflection by specialization of reflective code to an equivalent implementation using only static techniques. The use of dynamic reflection is constrained in order to ensure that the specialized code can be generated and will have a reasonable size.
https://pub.dev/packages/reflectable
BSD 3-Clause "New" or "Revised" License
374 stars 56 forks source link

Upgrade reflectable to use new version of analyzer #326

Closed eernstg closed 4 months ago

eernstg commented 6 months ago

This PR changes reflectable such that it uses the analyzer version 6.4.0, and also updates other dependencies.

This includes several changes to the code associated with evaluation of constant expressions (where the new version of the analyzer does not support the approach which was used for this purpose previously).

matt-hall-zory commented 5 months ago

It looks like you have path ^1.9.0 set as the minimum version. However, this will rule out use of integration_test which is pinned by flutter to 1.8.3.

Because every version of integration_test from sdk depends on path 1.8.3 and every version of reflectable from git depends on path ^1.9.0, integration_test from sdk is incompatible with reflectable from git. So, because zory depends on both reflectable from git and integration_test from sdk, version solving failed.

eernstg commented 5 months ago

Thanks for the heads-up, @matt-hall-zory! I'll adjust the version to 1.8.3.

PS: I'm waiting for a feature that would restore the ability to evaluate constants using analyzer 6.3.0, so I can't land this one right now.

eernstg commented 5 months ago

Unfortunately, we can't upgrade to the new analyzer yet (that is, this PR cannot be landed): As long as we don't have access to constant expression evaluation we get errors like 'Invalid constant const InstanceInvokeCapability('arg0') in capability list' for just about any of the tests (and hence, almost certainly, for any actual usage as well).

eernstg commented 4 months ago

We still don't have "official" support for constant evaluation in the analyzer, but I've taken a shortcut: Importing some src libraries. This is not guaranteed to continue to work (because breaking changes in src libraries are not breaking ;-), but it will get us on track again.

@sigurdm, would you be able to take a look at this PR?

eernstg commented 4 months ago

@stan-at-work and @Sten435, thanks for the reviewing votes!

For this package (or anything in github.com/google and similar locations), I do need an approving review from a Google employee as well. So that's the reason why this hasn't landed yet.

eernstg commented 4 months ago

:tada: Unstuck! 4.0.6 is here.

codekeyz commented 3 months ago

Amazing work @eernstg