-
Notifications
You must be signed in to change notification settings - Fork 28
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
Conversation
There was a problem hiding this 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.
Language/Statements/Local_Variable_Declaration/declared_type_A01_t01.dart
Outdated
Show resolved
Hide resolved
Language/Statements/Local_Variable_Declaration/declared_type_A02_t01.dart
Outdated
Show resolved
Hide resolved
Language/Statements/Local_Variable_Declaration/declared_type_A02_t02.dart
Outdated
Show resolved
Hide resolved
Language/Statements/Local_Variable_Declaration/declared_type_A03_t01.dart
Show resolved
Hide resolved
Language/Statements/Local_Variable_Declaration/declared_type_A03_t01.dart
Outdated
Show resolved
Hide resolved
Language/Statements/Local_Variable_Declaration/declared_type_A03_t01.dart
Outdated
Show resolved
Hide resolved
Language/Statements/Local_Variable_Declaration/declared_type_A03_t01.dart
Outdated
Show resolved
Hide resolved
Language/Statements/Local_Variable_Declaration/declared_type_A03_t01.dart
Show resolved
Hide resolved
Language/Statements/Local_Variable_Declaration/declared_type_A04_t01.dart
Outdated
Show resolved
Hide resolved
/// 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 |
There was a problem hiding this comment.
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.
Tests updated. Please review |
Fix typo: Missing 'the'.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
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>
No description provided.