Skip to content

[Enhanced parts] Deferred import in part file fully shadows one in a parent file #61806

@sgrekhov

Description

@sgrekhov

Please see https://github.com/dart-lang/co19/blob/master/LanguageFeatures/Parts-with-imports/scope_A06_t02.dart and its parts:
https://github.com/dart-lang/co19/blob/master/LanguageFeatures/Parts-with-imports/scope_A06_t02_part1.dart
https://github.com/dart-lang/co19/blob/master/LanguageFeatures/Parts-with-imports/scope_A06_t02_part2.dart

part1 imports one deferred library as l. part2 imports another deferred library as l. In part2 call of member that exists in the library imported in part1 but absent in the library imported in part2 leads to compile-time error. Is this an issue or expected behavior?

Note: the output below is obtainet with dart-lang/co19#3365 applied. The current output (with no changes from this PR) a slightly different.

$ python3 tools/test.py -n analyzer-asserts-linux co19/LanguageFeatures/Parts-with-imports/scope_A06_t02
No build targets found.
Test configuration:
    analyzer-asserts-linux(architecture: x64, compiler: dart2analyzer, mode: release, runtime: none, system: linux, enable-asserts, use-sdk)
Suites tested: co19

FAILED: dart2analyzer-none release_x64 co19/LanguageFeatures/Parts-with-imports/scope_A06_t02
Expected: Pass
Actual: CompileTimeError

--- Command "dart2analyzer" (took 04.000042s):
DART_CONFIGURATION=ReleaseX64 out/ReleaseX64/dart-sdk/bin/dart out/ReleaseX64/gen/dartanalyzer.dart.snapshot -Dtest_runner.configuration=analyzer-asserts-linux --enable-experiment=enhanced-parts --ignore-unrecognized-flags --packages=/home/sgrekhov/Google/dart-sdk/sdk/.dart_tool/package_config.json --format=json /home/sgrekhov/Google/dart-sdk/sdk/tests/co19/src/LanguageFeatures/Parts-with-imports/scope_A06_t02.dart

unexpected analysis errors in scope_A06_t02_part2.dart:
- Line 46, column 22: COMPILE_TIME_ERROR.UNDEFINED_PREFIXED_NAME
  The name 'counter' is being referenced through the prefix 'l', but it isn't defined in any of the libraries imported using that prefix.

--- Re-run this test:
python3 tools/test.py -n analyzer-asserts-linux co19/LanguageFeatures/Parts-with-imports/scope_A06_t02
[00:04 | 100% | +    0 | -    1]

=== 0 tests passed, 1 failed ===

Metadata

Metadata

Assignees

No one assigned

    Labels

    closed-as-intendedClosed as the reported issue is expected behaviorfeature-enhanced-partsRegarding the 'enhanced-parts' featuretype-questionA question about expected behavior or functionality

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions