8000 CompilationUnit.directive.stringValue Strips Path Separators on Windows · Issue #59629 · dart-lang/sdk · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
CompilationUnit.directive.stringValue Strips Path Separators on Windows #59629
Open
@BenAuerDev

Description

@BenAuerDev

CompilationUnit.directives.uri.stringValue behaves inconsistently across platforms. On Windows, path separators in part and part of directives are stripped, whereas on Linux, they are preserved.

Current Behavior
For the following directives in Dart code:

part '../filename.dart';
part 'sub_dir/filename.dart';

part of '../filename.dart';
part of 'sub_dir/filename.dart';
  • Linux Output:
    ../filename.dart and sub_dir/filename.dart

  • Windows Output:
    ..filename.dart and sub_dirfilename.dart

Expected Behavior
For the above directives:

  • Linux Output (unchanged):
    ../filename.dart and sub_dir/filename.dart

  • Windows Output:
    ..\filename.dart and sub_dir\filename.dart

sdk version: '>=3.3.0 <4.0.0'
analyzer: '^6.0.0'

Related Work:
I encountered this while I was working on a PR at serverpod where I tested generated code using CompilationUnit and comparing CompilationUnit.directives.uri.stringValue to the expected path.

This test worked fine on Linux but failed on Windows due to the inconsistency.

Log of the directives of the CompilationUnit in windows:
selection_060_720

Log of directive.uri.stringValue on windows:
selection_064_360

Log of directive.uri.stringValue on Linux:
selection_065_360

If I can help with any further information, you can holla at me any time 💪

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2A bug or feature request we're likely to work onarea-dart-modelFor issues related to conformance to the language spec in the parser, compilers or the CLI analyzer.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Rel 2CF4 ationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0