Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit b5ff349

Browse files
author
Dart CI
committed
Version 2.14.0-59.0.dev
Merge commit 'f193637d826113fa4ca074d1e075c8ee7ec42e62' into 'dev'
2 parents 90993fc + f193637 commit b5ff349

File tree

3 files changed

+32
-4
lines changed

3 files changed

+32
-4
lines changed

pkg/analyzer/lib/src/util/yaml.dart

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class Merger {
3030
/// * maps are merged recursively.
3131
/// * if map values cannot be merged, the overriding value is taken.
3232
///
33-
YamlNode merge(YamlNode o1, YamlNode? o2) {
33+
YamlNode merge(YamlNode o1, YamlNode o2) {
3434
// Handle promotion first.
3535
YamlMap listToMap(YamlList list) {
3636
Map<YamlNode, YamlNode> map =
@@ -56,7 +56,10 @@ class Merger {
5656
return mergeList(o1, o2);
5757
}
5858
// Default to override, unless the overriding value is `null`.
59-
return o2 ?? o1;
59+
if (o2 is YamlScalar && o2.value == null) {
60+
return o1;
61+
}
62+
return o2;
6063
}
6164

6265
/// Merge lists, avoiding duplicates.
@@ -75,7 +78,7 @@ class Merger {
7578
YamlMap mergeMap(YamlMap m1, YamlMap m2) {
7679
Map<YamlNode, YamlNode> merged =
7780
HashMap<YamlNode, YamlNode>(); // equals: _equals, hashCode: _hashCode
78-
m1.nodes.forEach((k, v) {
81+
m1.nodeMap.forEach((k, v) {
7982
merged[k] = v;
8083
});
8184
m2.nodeMap.forEach((k, v) {

pkg/analyzer/test/source/analysis_options_provider_test.dart

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,31 @@ include: foo.include
195195
}
196196
}
197197

198+
void test_getOptions_include_emptyLints() {
199+
pathTranslator.newFile('/foo.include', r'''
200+
linter:
201+
rules:
202+
- prefer_single_quotes
203+
''');
204+
pathTranslator.newFile('/$analysisOptionsYaml', r'''
205+
include: foo.include
206+
linter:
207+
rules:
208+
# avoid_print: false
209+
''');
210+
YamlMap options = _getOptions('/');
211+
expect(options, hasLength(2));
212+
{
213+
var linter = options.valueAt('linter') as YamlMap;
214+
expect(linter, hasLength(1));
215+
{
216+
var rules = linter.valueAt('rules') as YamlList;
217+
expect(rules, hasLength(1));
218+
expect(rules[0], 'prefer_single_quotes');
219+
}
220+
}
221+
}
222+
198223
void test_getOptions_include_missing() {
199224
pathTranslator.newFile('/$analysisOptionsYaml', r'''
200225
include: /foo.include

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 14
2929
PATCH 0
30-
PRERELEASE 58
30+
PRERELEASE 59
3131
PRERELEASE_PATCH 0

0 commit comments

Comments
 (0)