Visitar URL original
Fix import source locations by Gabriella439 · Pull Request #815 · dhall-lang/dhall-haskell · GitHub
Skip to content

Fix import source locations - #815

Merged
Gabriella439 merged 2 commits into
masterfrom
gabriel/fix_import_loc
Feb 12, 2019
Merged

Gabriella439 merged 2 commits into
masterfrom
gabriel/fix_import_loc

Conversation

@Gabriella439

Copy link
Copy Markdown
Collaborator

.. as caught by @Profpatsch in:

#812 (comment)

Before this change the location was always being reported as (stdin):1:1
because the SourcedException kept getting modified with a broader
source location in the Note branch of loadWith.

This was originally done so that alternative imports would show the entire
source span, but it mistakenly just kept bubbling up regardless of whether or
not there were alternative imports.

Instead, this includes an approximate source span for alternative imports.
The source span bounds are correct but the contents just show which imports
were alternated, even if they might have been buried in a larger expression.

For example, if the original expression had been:

Some ./x ? None ./y

... then the source span for the error message would display just:

./x ? ./y

... which is probably as good as it will get for now.

.. as caught by @Profpatsch in:

#812 (comment)

Before this change the location was always being reported as `(stdin):1:1`
because the `SourcedException` kept getting modified with a broader
source location in the `Note` branch of `loadWith`.

This was originally done so that alternative imports would show the entire
source span, but it mistakenly just kept bubbling up regardless of whether or
not there were alternative imports.

Instead, this includes an approximate source span for alternative imports.
The source span bounds are correct but the contents just show which imports
were alternated, even if they might have been buried in a larger expression.

For example, if the original expression had been:

```haskell
Some ./x ? None ./y
```

... then the source span for the error message would display just:

```haskell
./x ? ./y
```

... which is probably as good as it will get for now.
@Gabriella439
Gabriella439 merged commit 112efa7 into master Feb 12, 2019
@Gabriella439
Gabriella439 deleted the gabriel/fix_import_loc branch February 12, 2019 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant