Skip to content

Commit

Permalink
Version 3.5.0-235.0.dev
Browse files Browse the repository at this point in the history
Merge 63d6e6f into dev
  • Loading branch information
Dart CI committed Jun 7, 2024
2 parents 41acb19 + 63d6e6f commit accb5c2
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
#
# Stats:
# - 42 "needsEvaluation"
# - 337 "needsFix"
# - 414 "hasFix"
# - 336 "needsFix"
# - 415 "hasFix"
# - 516 "noFix"

AnalysisOptionsErrorCode.INCLUDED_FILE_PARSE_ERROR:
Expand Down Expand Up @@ -3217,9 +3217,7 @@ ParserErrorCode.SETTER_IN_FUNCTION:
ParserErrorCode.STACK_OVERFLOW:
status: noFix
ParserErrorCode.STATIC_CONSTRUCTOR:
status: needsFix
notes: |-
Remove the `static` keyword.
status: hasFix
ParserErrorCode.STATIC_GETTER_WITHOUT_BODY:
status: needsFix
notes: |-
Expand Down Expand Up @@ -3640,9 +3638,7 @@ WarningCode.NON_CONST_CALL_TO_LITERAL_CONSTRUCTOR:
notes: |-
The fix is to add `const` before the constructor invocation.
WarningCode.NON_CONST_CALL_TO_LITERAL_CONSTRUCTOR_USING_NEW:
status: needsFix
notes: |-
The fix is to replace `new` with `const`.
status: hasFix
WarningCode.NON_NULLABLE_EQUALS_PARAMETER:
status: needsFix
notes: |-
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1469,6 +1469,9 @@ final _builtInNonLintProducers = <ErrorCode, List<ProducerGenerator>>{
ParserErrorCode.SETTER_CONSTRUCTOR: [
RemoveLexeme.keyword,
],
ParserErrorCode.STATIC_CONSTRUCTOR: [
RemoveLexeme.keyword,
],
ParserErrorCode.VAR_AND_TYPE: [
RemoveTypeAnnotation.fixVarAndType,
RemoveVar.new,
Expand Down Expand Up @@ -1579,6 +1582,9 @@ final _builtInNonLintProducers = <ErrorCode, List<ProducerGenerator>>{
WarningCode.MUST_CALL_SUPER: [
AddCallSuper.new,
],
WarningCode.NON_CONST_CALL_TO_LITERAL_CONSTRUCTOR_USING_NEW: [
ReplaceNewWithConst.new,
],
WarningCode.NULLABLE_TYPE_IN_CATCH_CLAUSE: [
RemoveQuestionMark.new,
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,19 @@ class C {
''');
}

Future<void> test_staticConstructor() async {
await resolveTestCode('''
class C {
static C.c(){}
}
''');
await assertHasFix('''
class C {
C.c(){}
}
''');
}

Future<void> test_staticTopLevelDeclaration_enum() async {
await resolveTestCode(r'''
static enum E { v }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ class ReplaceNewWithConstTest extends FixProcessorLintTest {
@override
String get lintCode => LintNames.prefer_const_constructors;

@override
void setUp() {
super.setUp();
writeTestPackageConfig(meta: true);
}

Future<void> test_new() async {
await resolveTestCode('''
class C {
Expand Down Expand Up @@ -137,4 +143,23 @@ void f() {
// handled by ADD_CONST
await assertNoFix();
}

Future<void> test_nonConstCallToLiteralConstructorUsingNew() async {
await resolveTestCode('''
import 'package:meta/meta.dart';
class A {
@literal
const A();
}
var a = new A();
''');
await assertHasFix('''
import 'package:meta/meta.dart';
class A {
@literal
const A();
}
var a = const A();
''');
}
}
2 changes: 1 addition & 1 deletion tools/VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ CHANNEL dev
MAJOR 3
MINOR 5
PATCH 0
PRERELEASE 234
PRERELEASE 235
PRERELEASE_PATCH 0

0 comments on commit accb5c2

Please sign in to comment.