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
dart2js in NNBD prints false in this example as well.
The constant evaluation logic in the CFE is looking at the value of defaultValue from the call site, but it is not processing the default value from the constructor definition at this time, so I can see why the kernel file contains the constant null and why dart2js also prints false. I thought however that all constant evaluation was done in the CFE, so I was surprised to see that (b) prints true.
Note: the breaking change to make String.fromEnvironment have a default value is not finalized yet: #40678
/cc @johnniwinther - FYI this is a piece in the CFE constant evaluator that may need attention. Currently it embeds the default value implicitly with that "null", you may be able to extract the default value from the target procedure instead.
The text was updated successfully, but these errors were encountered:
sigmundch
added
area-vm
Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.
NNBD
Issues related to NNBD Release
labels
Mar 11, 2020
The default value of
String.fromEnvironment
behaves differently when using kernel inputs (or snapshots) than when running from source on the VM.Here is a sample repro:
When running:
(a) prints false
(b) prints true
(c) prints false
dart2js in NNBD prints false in this example as well.
The constant evaluation logic in the CFE is looking at the value of
defaultValue
from the call site, but it is not processing the default value from the constructor definition at this time, so I can see why the kernel file contains the constantnull
and why dart2js also prints false. I thought however that all constant evaluation was done in the CFE, so I was surprised to see that (b) prints true.Note: the breaking change to make String.fromEnvironment have a default value is not finalized yet: #40678
If the decision is to move forward with the change to use
defaultValue=''
, the constant evaluator needs to be updated here to handle it properly:https://github.com/dart-lang/sdk/blob/master/pkg/front_end/lib/src/fasta/kernel/constant_evaluator.dart#L1988
/cc @johnniwinther - FYI this is a piece in the CFE constant evaluator that may need attention. Currently it embeds the default value implicitly with that "null", you may be able to extract the default value from the target procedure instead.
The text was updated successfully, but these errors were encountered: