diff options
author | Benjamin Bykowski <alpha-theta@web.de> | 2015-07-05 01:38:22 +0200 |
---|---|---|
committer | Thomas Miedema <thomasmiedema@gmail.com> | 2015-07-05 01:39:39 +0200 |
commit | 5d48e67fac952f7188fc9ebcfbf6e3ccb9b75705 (patch) | |
tree | 62b223fdfd46ac0fb796b5a8976ef5e74ce82716 /testsuite | |
parent | 8e12a21546877003ee13d87ab784ee1b9d4bd4d7 (diff) | |
download | haskell-5d48e67fac952f7188fc9ebcfbf6e3ccb9b75705.tar.gz |
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
Diffstat (limited to 'testsuite')
-rwxr-xr-x | testsuite/tests/ghci/scripts/Defer03.hs | 7 | ||||
-rw-r--r-- | testsuite/tests/ghci/scripts/T8353.script | 22 | ||||
-rw-r--r-- | testsuite/tests/ghci/scripts/T8353.stderr | 25 | ||||
-rwxr-xr-x | testsuite/tests/ghci/scripts/all.T | 1 |
4 files changed, 55 insertions, 0 deletions
diff --git a/testsuite/tests/ghci/scripts/Defer03.hs b/testsuite/tests/ghci/scripts/Defer03.hs new file mode 100755 index 0000000000..b91a7ac8d0 --- /dev/null +++ b/testsuite/tests/ghci/scripts/Defer03.hs @@ -0,0 +1,7 @@ +module Main where + +a :: Int +a = 'p' + +main :: IO () +main = print "No errors!" diff --git a/testsuite/tests/ghci/scripts/T8353.script b/testsuite/tests/ghci/scripts/T8353.script new file mode 100644 index 0000000000..d93fb6e4cb --- /dev/null +++ b/testsuite/tests/ghci/scripts/T8353.script @@ -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! diff --git a/testsuite/tests/ghci/scripts/T8353.stderr b/testsuite/tests/ghci/scripts/T8353.stderr new file mode 100644 index 0000000000..7303142d10 --- /dev/null +++ b/testsuite/tests/ghci/scripts/T8353.stderr @@ -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' diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T index 747e708aad..1efa0099f1 100755 --- a/testsuite/tests/ghci/scripts/all.T +++ b/testsuite/tests/ghci/scripts/all.T @@ -171,6 +171,7 @@ test('T8113', normal, ghci_script, ['T8113.script']) test('T8172', when(opsys('mingw32'), normalise_drive_letter), ghci_script, ['T8172.script']) test('T8215', normal, ghci_script, ['T8215.script']) +test('T8353', normal, ghci_script, ['T8353.script']) test('T8357', normal, ghci_script, ['T8357.script']) test('T8383', normal, ghci_script, ['T8383.script']) test('T8469', normal, ghci_script, ['T8469.script']) |