Fix paths in nested relative includes

Fixes #1321
This commit is contained in:
Iavor Diatchki 2022-02-07 10:19:47 -08:00
parent 2d1f2c1033
commit a53b24b8a0
7 changed files with 17 additions and 1 deletions

View File

@ -196,7 +196,9 @@ resolveInclude lf = pushPath lf $ do
case parseProgramWith (defaultConfig { cfgSource = thing lf, cfgPreProc = guessPreProc (thing lf) }) source of
Right prog -> do
Program ds <- withIncPath (thing lf) (noIncludeProgram prog)
Program ds <-
do path <- fromIncPath (thing lf)
withIncPath path (noIncludeProgram prog)
return ds
Left err -> M (raise [IncludeParseError err])

View File

@ -0,0 +1,4 @@
module A::B::C where
import A::B::D::E::F
include "G/H.pcry" // succeeds when run from `test/`

View File

@ -0,0 +1,2 @@
module A::B::D::E::F where
x = 1

View File

@ -0,0 +1,2 @@
y = 2
include "I.pcry"

View File

@ -0,0 +1 @@
z = 3

View File

@ -0,0 +1 @@
:m A::B::C

View File

@ -0,0 +1,4 @@
Loading module Cryptol
Loading module Cryptol
Loading module A::B::D::E::F
Loading module A::B::C