Skip to content

Commit

Permalink
Merge pull request #1419 from taimoorzaeem/issue1253
Browse files Browse the repository at this point in the history
Improve error message for ModuleNameMismatch error and add regression test.
  • Loading branch information
RyanGlScott authored Aug 29, 2022
2 parents bc92cd0 + c003895 commit 91c8227
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Cryptol/ModuleSystem/Monad.hs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ instance PP ModuleError where
ModuleNameMismatch expected found ->
hang (text "[error]" <+> pp (P.srcRange found) <.> char ':')
4 (vcat [ text "File name does not match module name:"
, text "Saw:" <+> pp (P.thing found)
, text " Actual:" <+> pp (P.thing found)
, text "Expected:" <+> pp expected
])

Expand Down
1 change: 1 addition & 0 deletions tests/issues/issue1253.icry
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
:l issue1253a.cry
8 changes: 8 additions & 0 deletions tests/issues/issue1253.icry.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Loading module Cryptol
Loading module Cryptol
Loading module Foo

[error] ./issue1253b.cry:1:8--1:11:
File name does not match module name:
Actual: Foo
Expected: issue1253b
8 changes: 8 additions & 0 deletions tests/issues/issue1253.icry.stdout.mingw32
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Loading module Cryptol
Loading module Cryptol
Loading module Foo

[error] .\issue1253b.cry:1:8--1:11:
File name does not match module name:
Actual: Foo
Expected: issue1253b
4 changes: 4 additions & 0 deletions tests/issues/issue1253a.cry
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module issue1253a where

import issue1253b

2 changes: 2 additions & 0 deletions tests/issues/issue1253b.cry
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module Foo where

0 comments on commit 91c8227

Please sign in to comment.