Skip to content

Commit 3ed1fc1

Browse files
author
Dart CI
committed
Version 2.19.0-435.0.dev
Merge ba097c6 into dev
2 parents 4851720 + ba097c6 commit 3ed1fc1

File tree

3 files changed

+61
-83
lines changed

3 files changed

+61
-83
lines changed

pkg/analyzer/lib/src/generated/error_verifier.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1245,6 +1245,14 @@ class ErrorVerifier extends RecursiveAstVisitor<void>
12451245
});
12461246
}
12471247

1248+
@override
1249+
void visitSwitchPatternCase(SwitchPatternCase node) {
1250+
_withHiddenElements(node.statements, () {
1251+
_duplicateDefinitionVerifier.checkStatements(node.statements);
1252+
super.visitSwitchPatternCase(node);
1253+
});
1254+
}
1255+
12481256
@override
12491257
void visitSwitchStatement(SwitchStatement node) {
12501258
_checkForSwitchExpressionNotAssignable(node);

pkg/analyzer/test/src/diagnostics/duplicate_definition_test.dart

Lines changed: 52 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1515,88 +1515,6 @@ bool get a => true;
15151515
''');
15161516
}
15171517

1518-
test_locals_block_if() async {
1519-
await assertErrorsInCode(r'''
1520-
void f(int p) {
1521-
if (p != 0) {
1522-
var a;
1523-
var a;
1524-
}
1525-
}
1526-
''', [
1527-
error(HintCode.UNUSED_LOCAL_VARIABLE, 40, 1),
1528-
error(HintCode.UNUSED_LOCAL_VARIABLE, 51, 1),
1529-
error(CompileTimeErrorCode.DUPLICATE_DEFINITION, 51, 1,
1530-
contextMessages: [message('/home/test/lib/test.dart', 40, 1)]),
1531-
]);
1532-
}
1533-
1534-
test_locals_block_method() async {
1535-
await assertErrorsInCode(r'''
1536-
class A {
1537-
m() {
1538-
int a;
1539-
int a;
1540-
}
1541-
}
1542-
''', [
1543-
error(HintCode.UNUSED_LOCAL_VARIABLE, 26, 1),
1544-
error(CompileTimeErrorCode.DUPLICATE_DEFINITION, 37, 1,
1545-
contextMessages: [message('/home/test/lib/test.dart', 26, 1)]),
1546-
error(HintCode.UNUSED_LOCAL_VARIABLE, 37, 1),
1547-
]);
1548-
}
1549-
1550-
@FailingTest(issue: 'https://github.com/dart-lang/sdk/issues/50502')
1551-
test_locals_block_switchCase() async {
1552-
await assertErrorsInCode(r'''
1553-
main() {
1554-
switch(1) {
1555-
case 1:
1556-
var a;
1557-
var a;
1558-
}
1559-
}
1560-
''', [
1561-
error(HintCode.UNUSED_LOCAL_VARIABLE, 45, 1),
1562-
error(HintCode.UNUSED_LOCAL_VARIABLE, 58, 1),
1563-
error(CompileTimeErrorCode.DUPLICATE_DEFINITION, 58, 1,
1564-
contextMessages: [message('/home/test/lib/test.dart', 45, 1)]),
1565-
]);
1566-
}
1567-
1568-
test_locals_block_switchCase_language218() async {
1569-
await assertErrorsInCode(r'''
1570-
// @dart = 2.18
1571-
main() {
1572-
switch(1) {
1573-
case 1:
1574-
var a;
1575-
var a;
1576-
}
1577-
}
1578-
''', [
1579-
error(HintCode.UNUSED_LOCAL_VARIABLE, 61, 1),
1580-
error(HintCode.UNUSED_LOCAL_VARIABLE, 74, 1),
1581-
error(CompileTimeErrorCode.DUPLICATE_DEFINITION, 74, 1,
1582-
contextMessages: [message('/home/test/lib/test.dart', 61, 1)]),
1583-
]);
1584-
}
1585-
1586-
test_locals_block_topLevelFunction() async {
1587-
await assertErrorsInCode(r'''
1588-
main() {
1589-
int m = 0;
1590-
m(a) {}
1591-
}
1592-
''', [
1593-
error(HintCode.UNUSED_LOCAL_VARIABLE, 15, 1),
1594-
error(CompileTimeErrorCode.DUPLICATE_DEFINITION, 24, 1,
1595-
contextMessages: [message('/home/test/lib/test.dart', 15, 1)]),
1596-
error(HintCode.UNUSED_ELEMENT, 24, 1),
1597-
]);
1598-
}
1599-
16001518
test_parameters_constructor_field_first() async {
16011519
await assertErrorsInCode(r'''
16021520
class A {
@@ -1673,6 +1591,58 @@ f(int a, double a) {}
16731591
]);
16741592
}
16751593

1594+
test_switchCase_localVariable_localVariable() async {
1595+
await assertErrorsInCode(r'''
1596+
// @dart = 2.18
1597+
void f() {
1598+
switch (0) {
1599+
case 0:
1600+
var a;
1601+
var a;
1602+
}
1603+
}
1604+
''', [
1605+
error(HintCode.UNUSED_LOCAL_VARIABLE, 64, 1),
1606+
error(CompileTimeErrorCode.DUPLICATE_DEFINITION, 77, 1,
1607+
contextMessages: [message('/home/test/lib/test.dart', 64, 1)]),
1608+
error(HintCode.UNUSED_LOCAL_VARIABLE, 77, 1),
1609+
]);
1610+
}
1611+
1612+
test_switchDefault_localVariable_localVariable() async {
1613+
await assertErrorsInCode(r'''
1614+
void f() {
1615+
switch (0) {
1616+
default:
1617+
var a;
1618+
var a;
1619+
}
1620+
}
1621+
''', [
1622+
error(HintCode.UNUSED_LOCAL_VARIABLE, 49, 1),
1623+
error(CompileTimeErrorCode.DUPLICATE_DEFINITION, 62, 1,
1624+
contextMessages: [message('/home/test/lib/test.dart', 49, 1)]),
1625+
error(HintCode.UNUSED_LOCAL_VARIABLE, 62, 1),
1626+
]);
1627+
}
1628+
1629+
test_switchPatternCase_localVariable_localVariable() async {
1630+
await assertErrorsInCode(r'''
1631+
void f() {
1632+
switch (0) {
1633+
case 0:
1634+
var a;
1635+
var a;
1636+
}
1637+
}
1638+
''', [
1639+
error(HintCode.UNUSED_LOCAL_VARIABLE, 48, 1),
1640+
error(CompileTimeErrorCode.DUPLICATE_DEFINITION, 61, 1,
1641+
contextMessages: [message('/home/test/lib/test.dart', 48, 1)]),
1642+
error(HintCode.UNUSED_LOCAL_VARIABLE, 61, 1),
1643+
]);
1644+
}
1645+
16761646
test_typeParameters_class() async {
16771647
await assertErrorsInCode(r'''
16781648
class A<T, T> {}

tools/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ CHANNEL dev
2727
MAJOR 2
2828
MINOR 19
2929
PATCH 0
30-
PRERELEASE 434
30+
PRERELEASE 435
3131
PRERELEASE_PATCH 0

0 commit comments

Comments
 (0)