Skip to content
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

[Dot Shorthands] Language Tests in tests/language #57038

Open
Tracked by #57036 ...
kallentu opened this issue Nov 5, 2024 · 1 comment
Open
Tracked by #57036 ...

[Dot Shorthands] Language Tests in tests/language #57038

kallentu opened this issue Nov 5, 2024 · 1 comment
Assignees
Labels
area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). feature-dot-shorthands Implementation of the dot shorthands feature. type-enhancement A request for a change that isn't a bug

Comments

@kallentu
Copy link
Member

kallentu commented Nov 5, 2024

Write up language tests for the tests/language repository.

Test Tracker

https://docs.google.com/spreadsheets/d/19L0AhfQjS4VjvkdQ1lz61SZhK_nGjuPzs6OODEUyPx0/edit?usp=sharing&resourcekey=0-UwYFyigOGgtphjW50XztsQ

@kallentu kallentu added the feature-dot-shorthands Implementation of the dot shorthands feature. label Nov 5, 2024
@kallentu kallentu self-assigned this Nov 5, 2024
@kallentu kallentu changed the title [Enum Shorthands] Language Tests [Enum Shorthands] Language Tests in tests/language Nov 5, 2024
@dart-github-bot
Copy link
Collaborator

Summary: The issue requests the addition of language tests for enum shorthands in the tests/language repository. The tests are currently in progress and depend on the final specification for enum shorthands.

@dart-github-bot dart-github-bot added area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). triage-automation See https://github.com/dart-lang/ecosystem/tree/main/pkgs/sdk_triage_bot. type-enhancement A request for a change that isn't a bug labels Nov 5, 2024
@devoncarew devoncarew removed the triage-automation See https://github.com/dart-lang/ecosystem/tree/main/pkgs/sdk_triage_bot. label Nov 6, 2024
copybara-service bot pushed a commit that referenced this issue Nov 19, 2024
This CL adds language tests for the simple identifier variation of enum shorthands. In these tests, we are testing prefix identifiers with a single simple identifier.

For example, `Decoration(fit: BoxFit.cover)` where `fit` has the type `BoxFit?`, we would be able to turn this into `Decoration(fit: .cover)` with enum shorthands.

The tests also test erroneous ways that someone can use the `==` operator like the shorthand not being on the RHS.

Bug: #57038
Change-Id: I03610db2a683e9c2cdf8c12a99c7808171377e3a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393606
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
copybara-service bot pushed a commit that referenced this issue Nov 20, 2024
…e identifier tests.

Follow up to the comments here: https://dart-review.googlesource.com/c/sdk/+/393606/comment/138e0340_c13d55f6/

Add the same tests, but testing mixins and enum shorthands.

Bug: #57038
Change-Id: Ia8f1176570253590d5b0757a603ea27f74e5a6fa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/396302
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
copybara-service bot pushed a commit that referenced this issue Nov 21, 2024
…s, and collection literals for simple identifiers.

Follow up tests from Erik's comment here: https://dart-review.googlesource.com/c/sdk/+/393606/comments/16e214b1_4bbfad8f

This CL adds language tests for enum shorthands used in expressions where the context type is propagated down, for simple identifiers (no selector chains yet).

Once I do make tests for selector chains, I might reorganize the tests, but this will do for now.

Bug: #57038
Change-Id: Id4b6924611559c45817ecada491b6a8f05be3561
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/396703
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
copybara-service bot pushed a commit that referenced this issue Nov 26, 2024
…texts.

This CL adds tests for the enum shorthands behavior where the namespace for `T?` should be the same as `T`. We also test enum shorthands in declarations where the language has specified a `bool` context type.

Follow up to Erik's comment: https://dart-review.googlesource.com/c/sdk/+/393606/comments/16e214b1_4bbfad8f

Bug: #57038
Change-Id: I7962492a0459e987110e688d4159517e6c58f6ea
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/397182
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
copybara-service bot pushed a commit that referenced this issue Nov 26, 2024
…iers).

Testing expressions where enum shorthands might pop up and making sure there are no crashes.

Follow up to Erik's comment: https://dart-review.googlesource.com/c/sdk/+/393606/comments/16e214b1_4bbfad8f

Bug: #57038
Change-Id: Ia72b7f40f47dfc782085f56473ee68c5bd755d2b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/397500
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
copybara-service bot pushed a commit that referenced this issue Dec 4, 2024
Testing `bool` static members and constructors for language constructs that have a context type of `bool`, such as if-statements and while loops.

Follow up to Lasse's suggestions here: https://dart-review.googlesource.com/c/sdk/+/397182/comment/8db4ffcc_d04110bf/

Bug: #57038
Change-Id: I539f904b30e680d9749906f4db1f204125a572e6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/398020
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
copybara-service bot pushed a commit that referenced this issue Dec 4, 2024
Added back the `FutureOr` tests now that we've decided what we want to do for `FutureOr`. "`FutureOr<S>` denotes the same namespace as `S` for enum shorthands."

There are a few tests for `X extends T` where the context type is `X`. It would be a compile-time error to find static members of `T` even if `T` did have the corresponding static member.

Bug: #57038
Change-Id: Ibb8054d66e024d93b71878ed49bc7866b785b02c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/397986
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
copybara-service bot pushed a commit that referenced this issue Dec 9, 2024
A few starting tests for constructor and static member shorthands.

Test compile-time errors for `.new<types>` and `.new<types>()`.

Test that type alias get expanded before the shorthand inference is applied.

Bug: #57038
Change-Id: If32c9c027021ab31e7a9a5a07167058fac62f521
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/398588
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
copybara-service bot pushed a commit that referenced this issue Dec 16, 2024
Testing `FutureOr<S>` denotes the same namespace as `S` for enum shorthands and making sure `??` propagates the context type down.

The tests are in a similar style as the previous simple tests in the enum_shorthands folder.

Bug: #57038
Change-Id: I1b118b93b030cb2b3fe824101107f72ca29dd519
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/399520
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
copybara-service bot pushed a commit that referenced this issue Dec 17, 2024
Tests for `??` where context is from LHS and warnings when LHS is not nullable.

Context: https://dart-review.googlesource.com/c/sdk/+/399520/comments/ee1b4e32_2a0ed6e7

Bug: #57038
Change-Id: I563d54b447e90f97fbea1a972f2e06c2cc23c8fe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/401140
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
copybara-service bot pushed a commit that referenced this issue Dec 18, 2024
Similar cascade-related tests for testing static member and constructor shorthands.

Bug: #57038
Change-Id: I0c0f5121bbfc60473a1c757ee07462a2047e1fa0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/401240
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
copybara-service bot pushed a commit that referenced this issue Dec 26, 2024
…nd static methods.

Tests for using static method and constructor shorthands in collection literals.

Bug: #57038
Change-Id: I5151d53cc90966abb8d03dd453448987ccf8ce7a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/401981
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
copybara-service bot pushed a commit that referenced this issue Dec 27, 2024
Add tests similar to what we already have for ==, but with constructors and static methods.

Fix some prior == const tests.

Bug: #57038
Change-Id: Ia6afde353fd16d7dcd767d0514484cae5ac1730b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/401980
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
copybara-service bot pushed a commit that referenced this issue Jan 8, 2025
…ections and nested contexts.

Tests for nested context types, such as a constructor with an argument that also uses an enum shorthand.

Tests for selector chains. Multiple members and properties in one shorthand.

Bug: #57038
Change-Id: Ie9609b7594ccbe4347a59026d9e758868015fe64
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/402442
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
copybara-service bot pushed a commit that referenced this issue Jan 10, 2025
Testing that enum shorthands work even with import prefixes of declarations.

Bug: #57038
Change-Id: I8026f062a2b405d4f92efff7abad1a03fa229eda
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/402425
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
copybara-service bot pushed a commit that referenced this issue Jan 30, 2025
Similar format of tests to https://dart-review.googlesource.com/c/sdk/+/401980 and the other `==` and `!=` tests.

Making sure that equality with shorthand selector chains is allowed when the shorthand is on the RHS. Errors are produced when the shorthand is on the LHS, doesn't have the proper context, or has the context type of `Object`.

Bug: #57038
Change-Id: I905793b400a6f8b3c6bd068f70654dbbeec38557
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403965
Reviewed-by: Erik Ernst <eernst@google.com>
@kallentu kallentu changed the title [Enum Shorthands] Language Tests in tests/language [Dot Shorthands] Language Tests in tests/language Jan 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). feature-dot-shorthands Implementation of the dot shorthands feature. type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

3 participants