Skip to content

[TODO] pathutils./ can return invalid AbsoluteFile #13121

@timotheecour

Description

@timotheecour

pathutils./ can return invalid AbsoluteFile

Example

import compiler/pathutils
proc main()=
  var a: AbsoluteDir
  let b = "../foo".RelativeFile
  let c: AbsoluteFile = a/b
  echo c

main()

Current Output

../foo

Expected Output

../foo is not absolute so there's a loophole in API

Possible Solution

  • making a empty behave as cwd
  • throwing an exception is another option

Additional Information

Note: I dislike AbsoluteFile,AbsoluteDir,RelativeFile,RelativeDir as I've written in nim-lang/RFCs#71 and I think we can find a better API; at least it's not exposed outside compiler

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions