Skip to content

Commit

Permalink
Version 3.5.0-43.0.dev
Browse files Browse the repository at this point in the history
Merge 69b801f into dev
  • Loading branch information
Dart CI committed Apr 10, 2024
2 parents 3c5d9ad + 69b801f commit 46fee57
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 11 deletions.
1 change: 1 addition & 0 deletions pkg/analyzer/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* Support new meta annotation: `@mustBeConst`.
* Support new meta TargetKinds: `constructor`, `directive`, `enumValue`, and
`typeParameter`.
* Fix for accessing constants from extension type, when import prefixed.

## 6.4.1
* Patch for crash in ffi_verifier.
Expand Down
6 changes: 6 additions & 0 deletions pkg/analyzer/lib/src/dart/constant/evaluation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1641,6 +1641,12 @@ class ConstantVisitor extends UnifyingAstVisitor<Constant> {
Constant? _evaluatePropertyAccess(DartObjectImpl targetResult,
SimpleIdentifier identifier, AstNode errorNode) {
var propertyElement = identifier.staticElement;
if (propertyElement is PropertyAccessorElement &&
propertyElement.isGetter &&
propertyElement.isStatic) {
return null;
}

var propertyContainer = propertyElement?.enclosingElement;
switch (propertyContainer) {
case ExtensionElement():
Expand Down
20 changes: 20 additions & 0 deletions pkg/analyzer/test/src/dart/constant/evaluation_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4277,6 +4277,26 @@ String a
''');
}

test_visitPropertyAccess_constant_extensionType_prefixed() async {
newFile('$testPackageLibPath/a.dart', r'''
extension type const E(int it) {
static const v = 42;
}
''');

await assertNoErrorsInCode('''
import 'a.dart' as prefix;
const x = prefix.E.v;
''');

final result = _topLevelVar('x');
assertDartObjectText(result, '''
int 42
variable: self::@variable::x
''');
}

test_visitPropertyAccess_length_extension() async {
await assertErrorsInCode('''
extension ExtObject on Object {
Expand Down
2 changes: 2 additions & 0 deletions pkg/linter/lib/src/extensions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@ extension AstNodeExtension on AstNode {
return switch (self) {
ClassDeclaration() => self.augmentKeyword != null,
ConstructorDeclaration() => self.augmentKeyword != null,
FieldDeclaration() => self.augmentKeyword != null,
FunctionDeclarationImpl() => self.augmentKeyword != null,
FunctionExpression() => self.parent?.isAugmentation ?? false,
MethodDeclaration() => self.augmentKeyword != null,
MixinDeclaration() => self.augmentKeyword != null,
TopLevelVariableDeclaration() => self.augmentKeyword != null,
VariableDeclaration(declaredElement: var element) =>
element is PropertyInducingElement && element.isAugmentation,
_ => false
Expand Down
8 changes: 5 additions & 3 deletions pkg/linter/lib/src/rules/prefer_void_to_null.dart
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,11 @@ class _Visitor extends SimpleAstVisitor<void> {
}

if (parent != null) {
AstNode? member = parent.thisOrAncestorOfType<ClassMember>();
member ??= parent.thisOrAncestorOfType<NamedCompilationUnitMember>();
if (member?.isAugmentation ?? false) return;
AstNode? declaration = parent.thisOrAncestorOfType<ClassMember>();
declaration ??= parent.thisOrAncestorOfType<NamedCompilationUnitMember>();
declaration ??=
parent.thisOrAncestorOfType<TopLevelVariableDeclaration>();
if (declaration?.isAugmentation ?? false) return;
}

rule.reportLintForToken(node.name2);
Expand Down
7 changes: 0 additions & 7 deletions pkg/linter/test/rules/prefer_void_to_null_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ class PreferVoidToNullTest extends LintRuleTest {
@override
String get lintRule => 'prefer_void_to_null';

@FailingTest(
issue: 'https://github.com/dart-lang/linter/issues/4890',
reason: 'Null check operator used on a null value')
test_augmentedField() async {
newFile('$testPackageLibPath/a.dart', r'''
import augment 'test.dart';
Expand Down Expand Up @@ -102,10 +99,6 @@ augment Future<Null>? get v => null;
''');
}

@FailingTest(
issue: 'https://github.com/dart-lang/linter/issues/4890',
reason:
"CompileTimeErrorCode.DUPLICATE_DEFINITION [49, 1, The name 'v' is already defined.]")
test_augmentedTopLevelVariable() async {
newFile('$testPackageLibPath/a.dart', r'''
import augment 'test.dart';
Expand Down
2 changes: 2 additions & 0 deletions runtime/bin/elf_loader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,8 @@ bool LoadedElf::Load() {
CHECK(ReadSectionStringTable());
CHECK(ReadSections());

mappable_.reset();

return true;
}

Expand Down
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 42
PRERELEASE 43
PRERELEASE_PATCH 0

0 comments on commit 46fee57

Please sign in to comment.