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
{{ message }}
Repository navigation
Evaluate Xyz.fromEnvironment() as unknown value. #50045
We stopped reporting the compile-time error, because the result of evaluating fromEnvironment ? const MyType() : Type is unknown, which does not implement operator ==.
But this breaks google3, specifically Angular. The protobuf generator builds enum-like classes with fields like ApiSharedSetTypePB_Enum ((super) = ProtobufEnum (name = String (Either(left: String (''), right: String ('NEGATIVE_PLACEMENTS'))); value = int (17))). And Angular compiler attempt to do:
But EitherState does not implement getField(), and cannot not do this - which one should it take - the left, or the right one? The values are different.
The language tests are valid. The analyzer might be failing those tests, but that doesn't make them incorrect.
But the Angular compiler is currently broken. It's assuming that we can know the values of all constants at compile-time, but that isn't true. It needs to use hasKnownValue to determine whether the value is known and support the case where it returns false. We need to open an issue to let them know.
But EitherState does not implement getField(), and cannot not do this ...
It's perfectly valid for getField to return null, and I think that's probably the right thing for EitherState to do. That would also cause the Angular compiler to use defaultTo as the value of the string.
Activity
scheglov commentedon Sep 23, 2022
So, I attempted to model
unknownCondition ? left : rightwithEitherState, and ask both branches if they implementoperator ==. https://dart-review.googlesource.com/c/sdk/+/260681But this breaks google3, specifically Angular. The protobuf generator builds enum-like classes with fields like
ApiSharedSetTypePB_Enum ((super) = ProtobufEnum (name = String (Either(left: String (''), right: String ('NEGATIVE_PLACEMENTS'))); value = int (17))). And Angular compiler attempt to do:But
EitherStatedoes not implementgetField(), and cannot not do this - which one should it take - the left, or the right one? The values are different.scheglov commentedon Sep 23, 2022
So, I don't know how to proceed.
We either:
language/type/constants_test/07andlanguage/type/constants_test/08are incorrect, and go with a simple version from https://dart-review.googlesource.com/c/sdk/+/260681/1@bwilkerson @eernstg @joshualitt
bwilkerson commentedon Sep 23, 2022
The language tests are valid. The analyzer might be failing those tests, but that doesn't make them incorrect.
But the Angular compiler is currently broken. It's assuming that we can know the values of all constants at compile-time, but that isn't true. It needs to use
hasKnownValueto determine whether the value is known and support the case where it returnsfalse. We need to open an issue to let them know.It's perfectly valid for
getFieldto returnnull, and I think that's probably the right thing forEitherStateto do. That would also cause the Angular compiler to usedefaultToas the value of the string.scheglov commentedon Sep 23, 2022
Thank you, Brian.
I opened https://b.corp.google.com/issues/248605622
scheglov commentedon Sep 26, 2022
Special casing for Flutter.
https://dart-review.googlesource.com/c/sdk/+/261180
Issue 50045. Special case bool.fromEnvironment('dart.library.js_util'…
[analyzer] Add special case for bool.fromEnvironment('dart.library.js…
[web] Remove all usages of js_util. (#171871)
[web] Remove all usages of js_util. (flutter#171871)
[web] Remove all usages of js_util. (flutter#171871)
[web] Remove all usages of js_util. (flutter#171871)
[web] Remove all usages of js_util. (flutter#171871)
[web] Remove all usages of js_util. (#171871)