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

#2145. Add more local variable declaration tests #2254

Merged
merged 5 commits into from
Sep 4, 2023

Conversation

sgrekhov
Copy link
Contributor

@sgrekhov sgrekhov commented Sep 1, 2023

No description provided.

Copy link
Member

@eernstg eernstg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Noted a couple of typos. Also, I think the tests can be a bit stronger when it comes to variables whose static type is an intersection type.

/// which names the variable.
///
/// @description Checks that a variable is introduced into the scope after a
/// variable declaration statement is evaluated, and the name of this variable
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That isn't quite accurate: The local declaration introduces the name into the enclosing scope from the beginning of that scope:

var x = 1;

void main() {
  print(x); // Error (`x` is the local variable below, not the top-level variable).
  var x = true;
}

But it is true that we can't use that name (it's a compile-time error no matter how we use it) before the end of the initializing expression in the declaration of that name.

@sgrekhov
Copy link
Contributor Author

sgrekhov commented Sep 4, 2023

Tests updated. Please review

Fix typo: Missing 'the'.
Copy link
Member

@eernstg eernstg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@eernstg eernstg merged commit 7bf88af into dart-lang:master Sep 4, 2023
2 checks passed
copybara-service bot pushed a commit to dart-lang/sdk that referenced this pull request Sep 4, 2023
2023-09-04 sgrekhov22@gmail.com dart-lang/co19#2145. Fix roll failure (LateInitializationError) (dart-lang/co19#2257)
2023-09-04 sgrekhov22@gmail.com dart-lang/co19#2145. Add more local variable declaration tests (dart-lang/co19#2254)
2023-09-01 49699333+dependabot[bot]@users.noreply.github.com Bump actions/checkout from 3.5.3 to 3.6.0 (dart-lang/co19#2256)
2023-09-01 sgrekhov22@gmail.com dart-lang/co19#2213. Fix stack trace comparison (dart-lang/co19#2255)
2023-09-01 sgrekhov22@gmail.com dart-lang/co19#2145. Update variables tests according to the current spec. Part 2 (dart-lang/co19#2240)
2023-08-31 sgrekhov22@gmail.com dart-lang/co19#2242. Add LFCR line ending test (dart-lang/co19#2251)
2023-08-31 sgrekhov22@gmail.com dart-lang/co19#2145. Rename Local Variable declaration tests. Delete duplicates (dart-lang/co19#2252)
2023-08-30 sgrekhov22@gmail.com dart-lang/co19#2242. Add line endings tests (dart-lang/co19#2250)
2023-08-30 sgrekhov22@gmail.com Fixes dart-lang/co19#2245. Fix expectations in static_analysis_extension_types_A24_t02.dart (dart-lang/co19#2248)
2023-08-30 sgrekhov22@gmail.com dart-lang/co19#2242. Change CRLF line endings to LF (dart-lang/co19#2249)
2023-08-30 sgrekhov22@gmail.com Fixes dart-lang/co19#2244. Fix typo in dynamic_semantics_member_invocation_A01_t02.dart (dart-lang/co19#2247)
2023-08-30 sgrekhov22@gmail.com Fixes dart-lang/co19#2243. Remove duplicated constructors (dart-lang/co19#2246)
2023-08-29 sgrekhov22@gmail.com dart-lang/co19#2145. Update assertions and descriptions in the current Local variable declaration tests (dart-lang/co19#2241)
2023-08-25 sgrekhov22@gmail.com Fixes dart-lang/co19#2235. Add missing operator tests (dart-lang/co19#2239)
2023-08-25 sgrekhov22@gmail.com dart-lang/co19#2119. Code format and description update in operator tests (dart-lang/co19#2238)

Change-Id: I5aeac05c1aa4cbaa0762ce4f23c1ee916d1006a1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324040
Reviewed-by: Alexander Thomas <athom@google.com>
@sgrekhov sgrekhov deleted the co19-2145-4 branch November 14, 2023 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants