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
The next step in the CFE would be to support constant evaluation of expressions like const bool.hasEnvironment("name").
If the CFE uses hardwired default values for the defaultValue parameters of fromEnvironment constructors then it would probably be needed to switch to obtain those default values from the declarations, such that it would work with both the sdk and the sdk_nnbd defaults without special casing.
With this implementation, the new tests 'language{,_2}/bool/has_environment_test.dart' should pass. However, the vm does not (and never did) enforce the constraint that fromEnvironment constructors (and now also the hasEnvironment constructor) must throw if invoked at run time. So the tests 'language{,_2}/bool/has_environment_not_new_test.dart' will only succeed if the CFE detects that a particular invocation of these constructors will take place at run time (and then generates code to throw at run time), and that would be a new behavior. I mentioned this to @mkustermann, and he agreed that it would be acceptable to let these tests fail, that is, to continue to omit support for this particular error in the vm.
@johnniwinther, can you help finding a way to fit this into the cfe team work plan?
The text was updated successfully, but these errors were encountered:
Cf. breaking change #40678, https://dart-review.googlesource.com/c/sdk/+/139286 introduced
bool.hasEnvironment
into the sdk/sdk_nnbd.The next step in the CFE would be to support constant evaluation of expressions like
const bool.hasEnvironment("name")
.If the CFE uses hardwired default values for the
defaultValue
parameters offromEnvironment
constructors then it would probably be needed to switch to obtain those default values from the declarations, such that it would work with both the sdk and the sdk_nnbd defaults without special casing.With this implementation, the new tests 'language{,_2}/bool/has_environment_test.dart' should pass. However, the vm does not (and never did) enforce the constraint that
fromEnvironment
constructors (and now also thehasEnvironment
constructor) must throw if invoked at run time. So the tests 'language{,_2}/bool/has_environment_not_new_test.dart' will only succeed if the CFE detects that a particular invocation of these constructors will take place at run time (and then generates code to throw at run time), and that would be a new behavior. I mentioned this to @mkustermann, and he agreed that it would be acceptable to let these tests fail, that is, to continue to omit support for this particular error in the vm.@johnniwinther, can you help finding a way to fit this into the cfe team work plan?
The text was updated successfully, but these errors were encountered: