mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 10:49:00 +00:00
Properly resolve dependency part paths in summary linker.
R=scheglov@google.com Review URL: https://codereview.chromium.org/2540823002 .
This commit is contained in:
parent
ecb9b3618a
commit
4cdb5534bf
2 changed files with 34 additions and 2 deletions
|
@ -3551,9 +3551,15 @@ class LibraryElementInBuildUnit
|
|||
}
|
||||
}
|
||||
int result = _linkedLibrary.dependencies.length;
|
||||
Uri libraryUri = library._absoluteUri;
|
||||
List<String> partsRelativeToDependency =
|
||||
library.definingUnlinkedUnit.publicNamespace.parts;
|
||||
List<String> partsRelativeToLibraryBeingLinked = partsRelativeToDependency
|
||||
.map((partUri) =>
|
||||
resolveRelativeUri(libraryUri, Uri.parse(partUri)).toString())
|
||||
.toList();
|
||||
_linkedLibrary.dependencies.add(new LinkedDependencyBuilder(
|
||||
parts: library.definingUnlinkedUnit.publicNamespace.parts,
|
||||
uri: library._absoluteUri.toString()));
|
||||
parts: partsRelativeToLibraryBeingLinked, uri: libraryUri.toString()));
|
||||
_dependencies.add(library);
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -3617,6 +3617,32 @@ var v = f(g: (x, y) {});
|
|||
' abstract class D { void set f(int g(String s)); }');
|
||||
}
|
||||
|
||||
void test_inferredType_definedInSdkLibraryPart() {
|
||||
addSource(
|
||||
'/a.dart',
|
||||
r'''
|
||||
import 'dart:async';
|
||||
class A {
|
||||
m(Stream p) {}
|
||||
}
|
||||
''');
|
||||
LibraryElement library = checkLibrary(r'''
|
||||
import 'a.dart';
|
||||
class B extends A {
|
||||
m(p) {}
|
||||
}
|
||||
''');
|
||||
ClassElement b = library.definingCompilationUnit.types[0];
|
||||
ParameterElement p = b.methods[0].parameters[0];
|
||||
// This test should verify that we correctly record inferred types,
|
||||
// when the type is defined in a part of an SDK library. So, test that
|
||||
// the type is actually in a part.
|
||||
Element streamElement = p.type.element;
|
||||
if (streamElement is ClassElement) {
|
||||
expect(streamElement.source, isNot(streamElement.library.source));
|
||||
}
|
||||
}
|
||||
|
||||
void test_inferredType_usesSyntheticFunctionType_functionTypedParam() {
|
||||
checkLibrary('''
|
||||
int f(int x(String y)) => null;
|
||||
|
|
Loading…
Reference in a new issue