-
Notifications
You must be signed in to change notification settings - Fork 28
[Dot Shorthands] Bugs in static-access-shorthand tests #3122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
That's a lot of stuff! ;-D Presumably
This one looks like it should work. In line 43 at Line 51 is similar.
We could presumably use
I can't spot an issue that matches this description in A02_t01. The context type for the right hand operand of Perhaps line 60-64, including both, should just be deleted: A constant expression of the form We have a really weird combination here, because we can have an expression which is constant, but not potentially constant (like I think the expectations should simply be adjusted to expect success in the two cases line 48 and 52, preferably with a comment that explains why there is no error.
I don't see a problem with |
OK, turns out that I completely missed the last line in |
Oh there's another test that may need updating: https://github.com/dart-lang/co19/blob/master/LanguageFeatures/Static-access-shorthand/type_inference_A07_t01.dart. I think we're expecting the wrong value. // ...
C<int> c2 = .id("String").toInt(2);
Expect.equals(1, c2.value); // Should expect 2? |
Ah, yes. #3125 |
Changed status to blocked. Work on constant_expression_A10_t17.dart is blocked by dart-lang/language#4311 |
2025-04-03 [email protected] dart-lang/co19#3057. Add pattern assignment cases to for-in tests (dart-lang/co19#3130) 2025-04-02 [email protected] dart-lang/co19#3057. Add pattern assignment cases to while-loop tests (dart-lang/co19#3127) 2025-04-02 [email protected] dart-lang/co19#3057. Add pattern assignment cases to do-while tests (dart-lang/co19#3124) 2025-04-02 [email protected] dart-lang/co19#3122. Fix typo in type_inference_A07_t01.dart (dart-lang/co19#3125) 2025-04-01 [email protected] dart-lang/co19#3122. Fix errors in dot shorthands tests. (dart-lang/co19#3123) 2025-04-01 [email protected] dart-lang/co19#3057. Add switch statement tests (dart-lang/co19#3121) 2025-03-31 [email protected] dart-lang/co19#3057. Fix tests for literals and the type-check (dart-lang/co19#3116) Cq-Include-Trybots: luci.dart.try:analyzer-linux-release-try Change-Id: Ieb1f5fb641976186bb0f5715c64e020c2ba097ec Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/420440 Reviewed-by: Alexander Thomas <[email protected]> Reviewed-by: Erik Ernst <[email protected]> Commit-Queue: Alexander Thomas <[email protected]>
This CL adds support for constructor tearoffs in dot shorthands. If there's any type parameters on the tearoff and it's a constructor, we produce an error. I also updated the expectations of existing tests due to an early return of `InvalidExpression`s and added language + cfe tests for the new behavior. This CL fixes the following co19 tests and is a follow up to dart-lang/co19#3122 co19/LanguageFeatures/Static-access-shorthand/constant_expression_A03_t01 co19/LanguageFeatures/Static-access-shorthand/constant_expression_A04_t01 co19/LanguageFeatures/Static-access-shorthand/semantics_A05_t01 co19/LanguageFeatures/Static-access-shorthand/constant_expression_A03_t02 Bug: #59758, dart-lang/co19#3122 Change-Id: I1ea837342ad818cd3b1de9e422065f42e8a61d6b Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/419782 Commit-Queue: Kallen Tu <[email protected]> Reviewed-by: Chloe Stefantsova <[email protected]>
2025-04-25 [email protected] dart-lang/co19#3122. Expect an error in case of non-constant in a constant expression (dart-lang/co19#3159) 2025-04-24 [email protected] dart-lang/co19#3057. Add return statement in loops tests (dart-lang/co19#3158) 2025-04-24 [email protected] dart-lang/co19#3057. Update instance check tests and add negated instance check ones (dart-lang/co19#3131) 2025-04-23 [email protected] dart-lang/co19#3057. Add promotion tests for C-style for-loop (dart-lang/co19#3153) 2025-04-18 [email protected] Fixes dart-lang/co19#3122. Update constants evaluation according to the specification (dart-lang/co19#3150) Cq-Include-Trybots: luci.dart.try:analyzer-linux-release-try Change-Id: Ie89c9a3fbb920cb7e6488d652118ccc805b6f4ad Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/424760 Commit-Queue: Erik Ernst <[email protected]> Reviewed-by: Alexander Thomas <[email protected]> Reviewed-by: Erik Ernst <[email protected]> Commit-Queue: Alexander Thomas <[email protected]>
I was going through a bunch of the co19 tests while doing CFE implementation and came across these.
I believe we need an update on these tests.
cc. @eernstg to confirm for some of the spec related changes. I might also be wrong, so it'd be nice to get a double-check.
https://github.com/dart-lang/co19/blob/master/LanguageFeatures/Static-access-shorthand/type_inference_A01_t02.dart
Problem: This errors even without a shorthand:
https://github.com/dart-lang/co19/blob/master/LanguageFeatures/Static-access-shorthand/type_inference_A01_t01.dart
Problem:
e1
doesn't exist forE
.https://github.com/dart-lang/co19/blob/master/LanguageFeatures/Static-access-shorthand/semantics_A05_t01.dart
Problem: The LHS context is now
C
for example andC
doesn’t have a.new
. I think onlyObject
as the context would work here for constructor tearoffs.https://github.com/dart-lang/co19/blob/master/LanguageFeatures/Static-access-shorthand/patterns_A01_t03.dart
Problem:
res
is declared twicehttps://github.com/dart-lang/co19/blob/master/LanguageFeatures/Static-access-shorthand/non_ambiguity_A02_t02.dart
Problem: Typo on line 218 -
testMetods
->testMethods
.https://github.com/dart-lang/co19/blob/master/LanguageFeatures/Static-access-shorthand/grammar_A01_t05.dart
Problem: We seem to have this compile-time error even without shorthands.
https://github.com/dart-lang/co19/blob/master/LanguageFeatures/Static-access-shorthand/equality_A02_t09.dart
Problem: On line 64,
if ((C() as Object) == .new()) {}
actually works since Object has a.new()
ctor so no compile-time error is expected there.https://github.com/dart-lang/co19/blob/master/LanguageFeatures/Static-access-shorthand/equality_A02_t01.dart
https://github.com/dart-lang/co19/blob/master/LanguageFeatures/Static-access-shorthand/equality_A02_t02.dart
https://github.com/dart-lang/co19/blob/master/LanguageFeatures/Static-access-shorthand/equality_A02_t03.dart
https://github.com/dart-lang/co19/blob/master/LanguageFeatures/Static-access-shorthand/equality_A02_t04.dart
Problem:
if (C(0) == foo(.values[0])) {}
and all other instances where we use a shorthand as a method argument, should work because the context is the parameter type. No error expected?https://github.com/dart-lang/co19/blob/master/LanguageFeatures/Static-access-shorthand/equality_A01_t02.dart
Problem:
m3 == .instances[0]
wherem3
isMC
--MC
doesn’t have the getter/fieldinstances
.https://github.com/dart-lang/co19/blob/master/LanguageFeatures/Static-access-shorthand/constant_expression_A10_t17.dart
Problem: On line 48 and 52, the expressions for
M
andE
are evaluating tofalse
andtrue
, so we don’t evaluate the other branch in these examples and that's where the error is located, but is skipped over. Seems to be an implementation thing, but everything is working as expected, we just don't evaluate the false branch and therefore, no error is reported. This might actually just be a CFE/analyzer discrepancy. With the types added in, it seems like the analyzer reports errors, but the CFE doesn't for line 48 and 52.https://github.com/dart-lang/co19/blob/master/LanguageFeatures/Static-access-shorthand/constant_expression_A10_t13.dart
https://github.com/dart-lang/co19/blob/master/LanguageFeatures/Static-access-shorthand/constant_expression_A10_t15.dart
Problem: Missing error for
const b2 = (MC(42) as M) == .answer;
but I believe we're using the context typeM
andM
has a constanswer
which makes it so that we don't produce any errors.https://github.com/dart-lang/co19/blob/master/LanguageFeatures/Static-access-shorthand/constant_expression_A04_t01.dart
https://github.com/dart-lang/co19/blob/master/LanguageFeatures/Static-access-shorthand/constant_expression_A03_t02.dart
https://github.com/dart-lang/co19/blob/master/LanguageFeatures/Static-access-shorthand/constant_expression_A03_t01.dart
Problem: I need @eernstg's confirmation on this one too, but I believe we're grabbing the context of
C1
forExpect.isTrue(C1() == .new);
and the constructor tearoff doesn't work for this context.The text was updated successfully, but these errors were encountered: