Skip to content

Fix dropping of error locations#37

Merged
cchalmers merged 2 commits into
masterfrom
fix-error-locations
Jun 23, 2026
Merged

Fix dropping of error locations#37
cchalmers merged 2 commits into
masterfrom
fix-error-locations

Conversation

@cchalmers

Copy link
Copy Markdown
Owner

Since #14 the error locations often pointed to the end of the circuit instead of the correct location. That should now be fixed, along with a regression test.

Hopefully resolves #35.

@martijnbastiaan

Copy link
Copy Markdown
Collaborator

Cool! I did find an issue in the meantime, but I have yet to make a minimal reproducer out of it. I'll have a look.

Perhaps for testing you can use this structure:

https://github.com/clash-lang/checked-literals/blob/568a8603491bca0dbb24586828edf3040f30ee6f/tests/Test/Tasty/AssertGhc.hs

and

https://github.com/clash-lang/checked-literals/blob/568a8603491bca0dbb24586828edf3040f30ee6f/flake.nix#L42-L51

That way it doesn't just run in Nix.

@cchalmers cchalmers force-pushed the fix-error-locations branch from b6fd712 to f83ef95 Compare June 23, 2026 09:21
cchalmers and others added 2 commits June 23, 2026 17:05
Since #14 the error locations often pointed to the end of the circuit
instead of the correct location. Locate each generated binding at its
circuit expression so GHC blames the offending statement. The regression
test is in a separate PR.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Compiles tests/fixtures/BusError.hs (a deliberate type error on a bus) with
the plugin enabled and asserts that GHC reports the error on the offending
line rather than at the end of the circuit block.

Under cabal the plugin is found via the package environment file. Under
`nix build` the package isn't registered in a package db during its own
check phase, so the flake points GHC_PACKAGE_PATH (via the builder's
NIX_GHC_PACKAGE_PATH_FOR_TEST hook) at the in-place db, letting the test run
for real there too.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@cchalmers cchalmers force-pushed the fix-error-locations branch from f83ef95 to 36c873b Compare June 23, 2026 17:40
@cchalmers

Copy link
Copy Markdown
Owner Author

I've scaled back the CI changes to the minimum needed for nix to work. The multi-ghc nix support can come in another PR.

@cchalmers cchalmers merged commit 5258a44 into master Jun 23, 2026
5 checks passed
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.

Track confusing error messages

2 participants