Skip to content

Commit

Permalink
Version 3.3.0-139.0.dev
Browse files Browse the repository at this point in the history
Merge 09de615 into dev
  • Loading branch information
Dart CI committed Nov 15, 2023
2 parents 9f964ab + 09de615 commit 80ec10c
Show file tree
Hide file tree
Showing 22 changed files with 1,373 additions and 91 deletions.
2 changes: 1 addition & 1 deletion DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ vars = {
# https://chrome-infra-packages.appspot.com/p/gn/gn
"gn_version": "git_revision:e4702d7409069c4f12d45ea7b7f0890717ca3f4b",

"reclient_version": "git_revision:81e819b39d4743462857cc55430d898b9fcca1af",
"reclient_version": "git_revision:f75cfb7bca0c04516330f27867a855e8d1186677",

# Update from https://chrome-infra-packages.appspot.com/p/fuchsia/sdk/core
"fuchsia_sdk_version": "version:16.20231105.3.1",
Expand Down
40 changes: 22 additions & 18 deletions build/toolchain/linux/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ if (use_goma) {
assembler_prefix = "$goma_dir/gomacc "
compiler_prefix = "$goma_dir/gomacc "
link_prefix = "$goma_dir/gomacc "
gcc_compiler_prefix = compiler_prefix
} else if (use_rbe) {
assert(!use_goma)
rewrapper_args = [
Expand All @@ -36,14 +37,17 @@ if (use_goma) {
assembler_prefix = string_join(" ", assembler_args)
compiler_prefix = string_join(" ", compiler_args)
link_prefix = string_join(" ", link_args)
gcc_compiler_prefix = ""
} else if (use_ccache) {
assembler_prefix = "ccache "
compiler_prefix = "ccache "
link_prefix = "ccache "
gcc_compiler_prefix = compiler_prefix
} else {
assembler_prefix = ""
compiler_prefix = ""
link_prefix = ""
gcc_compiler_prefix = compiler_prefix
}

# Google's clang does not work for alpine, use alpine's system clang
Expand All @@ -63,9 +67,9 @@ gcc_toolchain("arm") {
prefix = arm_toolchain_prefix
}

cc = "${compiler_prefix}${prefix}gcc"
cxx = "${compiler_prefix}${prefix}g++"
asm = "${assembler_prefix}${prefix}gcc"
cc = "${gcc_compiler_prefix}${prefix}gcc"
cxx = "${gcc_compiler_prefix}${prefix}g++"
asm = "${gcc_compiler_prefix}${prefix}gcc"

ar = "${prefix}ar"
ld = "${link_prefix}${prefix}g++"
Expand Down Expand Up @@ -101,9 +105,9 @@ gcc_toolchain("arm64") {
prefix = arm64_toolchain_prefix
}

cc = "${compiler_prefix}${prefix}gcc"
cxx = "${compiler_prefix}${prefix}g++"
asm = "${assembler_prefix}${prefix}gcc"
cc = "${gcc_compiler_prefix}${prefix}gcc"
cxx = "${gcc_compiler_prefix}${prefix}g++"
asm = "${gcc_compiler_prefix}${prefix}gcc"

ar = "${prefix}ar"
ld = "${link_prefix}${prefix}g++"
Expand Down Expand Up @@ -155,9 +159,9 @@ gcc_toolchain("x86") {
if (ia32_toolchain_prefix != "") {
prefix = ia32_toolchain_prefix
}
cc = "${compiler_prefix}${prefix}gcc"
cxx = "${compiler_prefix}${prefix}g++"
asm = "${assembler_prefix}${prefix}gcc"
cc = "${gcc_compiler_prefix}${prefix}gcc"
cxx = "${gcc_compiler_prefix}${prefix}g++"
asm = "${gcc_compiler_prefix}${prefix}gcc"

readelf = "${prefix}readelf"
nm = "${prefix}nm"
Expand Down Expand Up @@ -192,9 +196,9 @@ gcc_toolchain("x64") {
if (x64_toolchain_prefix != "") {
prefix = x64_toolchain_prefix
}
cc = "${compiler_prefix}${prefix}gcc"
cxx = "${compiler_prefix}${prefix}g++"
asm = "${assembler_prefix}${prefix}gcc"
cc = "${gcc_compiler_prefix}${prefix}gcc"
cxx = "${gcc_compiler_prefix}${prefix}g++"
asm = "${gcc_compiler_prefix}${prefix}gcc"

readelf = "${prefix}readelf"
nm = "${prefix}nm"
Expand All @@ -213,9 +217,9 @@ gcc_toolchain("riscv32") {
prefix = riscv32_toolchain_prefix
}

cc = "${compiler_prefix}${prefix}gcc"
cxx = "${compiler_prefix}${prefix}g++"
asm = "${assembler_prefix}${prefix}gcc"
cc = "${gcc_compiler_prefix}${prefix}gcc"
cxx = "${gcc_compiler_prefix}${prefix}g++"
asm = "${gcc_compiler_prefix}${prefix}gcc"

ar = "${prefix}ar"
ld = "${link_prefix}${prefix}g++"
Expand Down Expand Up @@ -251,9 +255,9 @@ gcc_toolchain("riscv64") {
prefix = riscv64_toolchain_prefix
}

cc = "${compiler_prefix}${prefix}gcc"
cxx = "${compiler_prefix}${prefix}g++"
asm = "${assembler_prefix}${prefix}gcc"
cc = "${gcc_compiler_prefix}${prefix}gcc"
cxx = "${gcc_compiler_prefix}${prefix}g++"
asm = "${gcc_compiler_prefix}${prefix}gcc"

ar = "${prefix}ar"
ld = "${link_prefix}${prefix}g++"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ double weightedAverage(
double isNotImported = 0.0,
double keyword = 0.0,
double startsWithDollar = 0.0,
double superMatches = 0.0}) {
double superMatches = 0.0,
double localVariableDistance = 0.0}) {
assert(contextType.between(0.0, 1.0));
assert(elementKind.between(0.0, 1.0));
assert(hasDeprecated.between(-1.0, 0.0));
Expand All @@ -72,6 +73,7 @@ double weightedAverage(
assert(keyword.between(0.0, 1.0));
assert(startsWithDollar.between(-1.0, 0.0));
assert(superMatches.between(0.0, 1.0));
assert(localVariableDistance.between(0.0, 1.0));
var average = _weightedAverage([
contextType,
elementKind,
Expand All @@ -82,6 +84,7 @@ double weightedAverage(
keyword,
startsWithDollar,
superMatches,
localVariableDistance,
], FeatureComputer.featureWeights);
return (average + 1.0) / 2.0;
}
Expand Down Expand Up @@ -136,6 +139,7 @@ class FeatureComputer {
'localVariableDistance',
'startsWithDollar',
'superMatches',
'localVariableDistance',
];

/// The values of the weights used to compute an average of feature values.
Expand All @@ -153,6 +157,7 @@ class FeatureComputer {
1.00, // keyword
0.50, // startsWithDollar
1.00, // superMatches
1.00, // localVariableDistance
];

/// The type system used to perform operations on types.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1367,7 +1367,8 @@ class SuggestionBuilder {
isNotImported: isNotImported,
keyword: keyword,
startsWithDollar: startsWithDollar,
superMatches: superMatches);
superMatches: superMatches,
localVariableDistance: localVariableDistance);
var relevance = toRelevance(score);
listener?.computedFeatures(
contextType: contextType,
Expand Down
8 changes: 4 additions & 4 deletions pkg/analysis_server/test/domain_completion_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1881,12 +1881,12 @@ suggestions
kind: topLevelVariable
isNotImported: null
libraryUri: null
relevance: 504
relevance: 503
fooAB
kind: topLevelVariable
isNotImported: null
libraryUri: null
relevance: 504
relevance: 503
''');
}

Expand Down Expand Up @@ -1914,12 +1914,12 @@ suggestions
kind: topLevelVariable
isNotImported: null
libraryUri: null
relevance: 565
relevance: 558
foo01
kind: topLevelVariable
isNotImported: null
libraryUri: null
relevance: 511
relevance: 510
''');
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,32 @@ class LocalVariableTest2 extends CompletionRelevanceTest
with LocalVariableTestCases {
@override
TestingCompletionProtocol get protocol => TestingCompletionProtocol.version2;

Future<void> test_localVariable_vs_importedClass() async {
newFile('$testPackageLibPath/a.dart', r'''
class FooBarClass {}
''');

await addTestFile('''
import 'a.dart';
int f() {
final fooBar = 0;
fBa^
}
''');

assertOrder([
suggestionWith(
completion: 'fooBar',
kind: CompletionSuggestionKind.IDENTIFIER,
),
suggestionWith(
completion: 'FooBarClass',
kind: CompletionSuggestionKind.IDENTIFIER,
),
]);
}
}

mixin LocalVariableTestCases on CompletionRelevanceTest {
Expand Down
12 changes: 5 additions & 7 deletions pkg/analyzer/lib/src/dart/element/display_string_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ class ElementDisplayStringBuilder {
_multiline = multiline;

@override
String toString() {
return _buffer.toString();
}
String toString() => _buffer.toString();

void writeAbstractElement(ElementImpl element) {
_write(element.name ?? '<unnamed $runtimeType>');
Expand Down Expand Up @@ -89,7 +87,7 @@ class ElementDisplayStringBuilder {
_write('dynamic');
}

void writeEnumElement(EnumElementImpl element) {
void writeEnumElement(EnumElement element) {
_write('enum ');
_write(element.displayName);
_writeTypeParameters(element.typeParameters);
Expand Down Expand Up @@ -122,7 +120,7 @@ class ElementDisplayStringBuilder {
_writeDirectiveUri(element.uri);
}

void writeExtensionElement(ExtensionElementImpl element) {
void writeExtensionElement(ExtensionElement element) {
_write('extension ');
_write(element.displayName);
_writeTypeParameters(element.typeParameters);
Expand Down Expand Up @@ -195,7 +193,7 @@ class ElementDisplayStringBuilder {
_writeTypesIfNotEmpty(' implements ', element.interfaces);
}

void writeNeverType(NeverTypeImpl type) {
void writeNeverType(NeverType type) {
_write('Never');
_writeNullability(type.nullabilitySuffix);
}
Expand All @@ -210,7 +208,7 @@ class ElementDisplayStringBuilder {
_write(element.displayName);
}

void writeRecordType(RecordTypeImpl type) {
void writeRecordType(RecordType type) {
final positionalFields = type.positionalFields;
final namedFields = type.namedFields;
final fieldCount = positionalFields.length + namedFields.length;
Expand Down
17 changes: 5 additions & 12 deletions pkg/dartdev/lib/src/analysis_server.dart
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,10 @@ class AnalysisServer {
}

Future<EditBulkFixesResult> requestBulkFixes(
String filePath, bool inTestMode, List<String> codes,
{bool updatePubspec = false}) {
String filePath, bool inTestMode, List<String> codes) {
return _sendCommand('edit.bulkFixes', params: <String, dynamic>{
'included': [path.canonicalize(filePath)],
'inTestMode': inTestMode,
'updatePubspec': updatePubspec,
if (codes.isNotEmpty) 'codes': codes,
}).then((result) {
return EditBulkFixesResult.fromJson(
Expand All @@ -214,18 +212,13 @@ class AnalysisServer {

Future<void> shutdown({Duration? timeout}) async {
// Request shutdown.
final Future<void> future =
_sendCommand('server.shutdown').then((Map<String, dynamic> value) {
final Future<void> future = _sendCommand('server.shutdown').then((Map<String, dynamic> value) {
_shutdownResponseReceived = true;
return;
});
await (timeout != null
? future.timeout(timeout, onTimeout: () {
log.stderr(
'The analysis server timed out while shutting down.');
})
: future)
.whenComplete(dispose);
await (timeout != null ? future.timeout(timeout, onTimeout: () {
log.stderr('The analysis server timed out while shutting down.');
}) : future).whenComplete(dispose);
}

/// Send an `analysis.updateContent` request with the given [files].
Expand Down
9 changes: 0 additions & 9 deletions pkg/dartdev/lib/src/commands/fix.dart
Original file line number Diff line number Diff line change
Expand Up @@ -151,15 +151,6 @@ To use the tool, run either ['dart fix --dry-run'] for a preview of the proposed
// TODO(brianwilkerson) Be more intelligent about detecting infinite
// loops so that we can increase [maxPasses].
} while (pass < maxPasses && edits.isNotEmpty);
// If there are no more dart edits, check if there are any changes
// to pubspec
if (edits.isEmpty && detailsMap.isNotEmpty) {
var fixes = await server.requestBulkFixes(fixPath, inTestMode, [],
updatePubspec: true);
_mergeDetails(detailsMap, fixes.details);
edits = fixes.edits;
_applyEdits(server, edits);
}
return _FixRequestResult(details: detailsMap);
}

Expand Down
44 changes: 44 additions & 0 deletions pkg/front_end/lib/src/fasta/source/source_builder_mixins.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ import '../builder/builder.dart';
import '../builder/builder_mixins.dart';
import '../builder/declaration_builders.dart';
import '../builder/library_builder.dart';
import '../builder/member_builder.dart';
import '../builder/metadata_builder.dart';
import '../builder/name_iterator.dart';
import '../builder/procedure_builder.dart';
import '../builder/type_builder.dart';
import '../kernel/body_builder_context.dart';
Expand Down Expand Up @@ -260,3 +262,45 @@ mixin SourceDeclarationBuilderMixin implements DeclarationBuilderMixin {
@override
int get typeVariablesCount => typeParameters?.length ?? 0;
}

mixin SourceTypedDeclarationBuilderMixin implements IDeclarationBuilder {
/// Checks for conflicts between constructors and static members declared
/// in this type declaration.
void checkConstructorStaticConflict() {
NameIterator<MemberBuilder> iterator =
constructorScope.filteredNameIterator(
includeDuplicates: false, includeAugmentations: true);
while (iterator.moveNext()) {
String name = iterator.name;
MemberBuilder constructor = iterator.current;
Builder? member = scope.lookupLocalMember(name, setter: false);
if (member == null) continue;
if (!member.isStatic) continue;
// TODO(ahe): Revisit these messages. It seems like the last two should
// be `context` parameter to this message.
addProblem(templateConflictsWithMember.withArguments(name),
constructor.charOffset, noLength);
if (constructor.isFactory) {
addProblem(
templateConflictsWithFactory.withArguments("${this.name}.${name}"),
member.charOffset,
noLength);
} else {
addProblem(
templateConflictsWithConstructor
.withArguments("${this.name}.${name}"),
member.charOffset,
noLength);
}
}

scope.forEachLocalSetter((String name, Builder setter) {
Builder? constructor = constructorScope.lookupLocalMember(name);
if (constructor == null || !setter.isStatic) return;
addProblem(templateConflictsWithConstructor.withArguments(name),
setter.charOffset, noLength);
addProblem(templateConflictsWithSetter.withArguments(name),
constructor.charOffset, noLength);
});
}
}
Loading

0 comments on commit 80ec10c

Please sign in to comment.