mirrored from https://gitlab.haskell.org/ghc/ghc.git
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Easy way to defer type errors (implements #8353)
Added load! and reload! commands, effectively setting "-fdefer-type-errors" before loading a file and unsetting it after loading if it has not been set before. Differential Revision: https://phabricator.haskell.org/D960
- Loading branch information
Showing
7 changed files
with
117 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module Main where | ||
|
||
a :: Int | ||
a = 'p' | ||
|
||
main :: IO () | ||
main = print "No errors!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
-- Test :load! and :reload! | ||
|
||
-- main is independent of functions with type errors and thus | ||
-- executable after load | ||
-- warnings on type errors are emitted nevertheless | ||
:load! Defer03 | ||
|
||
-- fails to load module due to type errors | ||
:load Defer03 | ||
|
||
-- succeeds again to load module | ||
:reload! | ||
|
||
-- also succeeds, because the module has not been touched since load | ||
:reload | ||
|
||
-- now, after touching, reloading should fail | ||
:! touch Defer03.hs | ||
:reload | ||
|
||
-- using the deferred version of reload, loading should succeed again | ||
:reload! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
Defer03.hs:4:5: warning: | ||
Couldn't match expected type ‘Int’ with actual type ‘Char’ | ||
In the expression: 'p' | ||
In an equation for ‘a’: a = 'p' | ||
|
||
Defer03.hs:4:5: error: | ||
Couldn't match expected type ‘Int’ with actual type ‘Char’ | ||
In the expression: 'p' | ||
In an equation for ‘a’: a = 'p' | ||
|
||
Defer03.hs:4:5: warning: | ||
Couldn't match expected type ‘Int’ with actual type ‘Char’ | ||
In the expression: 'p' | ||
In an equation for ‘a’: a = 'p' | ||
|
||
Defer03.hs:4:5: error: | ||
Couldn't match expected type ‘Int’ with actual type ‘Char’ | ||
In the expression: 'p' | ||
In an equation for ‘a’: a = 'p' | ||
|
||
Defer03.hs:4:5: warning: | ||
Couldn't match expected type ‘Int’ with actual type ‘Char’ | ||
In the expression: 'p' | ||
In an equation for ‘a’: a = 'p' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters