Commit 4e21a089 authored by mnislaih's avatar mnislaih
Browse files

Unsoundness in the RTTI scheme

parent 9b4ee312
......@@ -27,7 +27,10 @@ test('print025', normal, ghci_script, ['print025.script'])
test('print026', normal, ghci_script, ['print026.script'])
test('print027', normal, ghci_script, ['print027.script'])
test('print028', if_compiler_lt('ghc','6.9', namebase('print028-6.8')), ghci_script, ['print028.script'])
test('print029', expect_broken, ghci_script, ['print029.script'])
test('print030', expect_broken, ghci_script, ['print030.script'])
test('print031', expect_broken, ghci_script, ['print031.script'])
test('print032', expect_broken, ghci_script, ['print032.script'])
test('break001', normal, ghci_script, ['break001.script'])
test('break002', normal, ghci_script, ['break002.script'])
......
:l print029.hs
let a = MkT2 [Just (1::Int)]
a
:break f
f a
:step
-- Unsound! A false type is assigned to x
-- reconstructType decides to stop too soon because
-- its BFS has recovered a monomorphic type
:p x
\ No newline at end of file
MkT2 [Just 1]
Breakpoint 0 activated at print029.hs:4:0-6
MkT2 Stopped at print029.hs:4:0-6
_result :: t Int = _
Stopped at print029.hs:4:6
_result :: t Int = _
x :: [Maybe Int] = [Just 1]
x = [Just 1]
:l print029.hs
let a = MkT2 (map Just [(1::Int)])
:break f
seq a ()
f a
:step
-- Unsound! A false type is assigned to x
-- reconstructType is forced to stop too soon
-- because the elements of the list in x are not evaluated yet
x
:q
Breakpoint 0 activated at print029.hs:4:0-6
()
MkT2 Stopped at print029.hs:4:0-6
_result :: t Int = _
Stopped at print029.hs:4:6
_result :: t Int = _
x :: t Int = _ : _
No instance for (Show (t Int))
arising from a use of `print' at <interactive>:1:0
Possible fix: add an instance declaration for (Show (t Int))
In a 'do' expression: print it
:set -fglasgow-exts
:l print031.hs
let a = MkT2 [Just (Phantom 1)]
:break f
a
f a
:step
-- ghc crashes now when the type for x is recovered
-- and unifyRTTI fails to compute a substitution
x
:q
Breakpoint 0 activated at print029.hs:4:0-6
()
MkT2 Stopped at print029.hs:4:0-6
_result :: t Int = _
Stopped at print029.hs:4:6
_result :: [Int] = _
x :: [Int] = _ : _
[Just (Phantom 1)]
:l print029.hs
let a = MkT2 [Just (1::Int)]
a
let b = MkT2 (map Just [2::Int]) -- Want to obtain a thunk
:break f2
f2 a b
:step
MkT2 [Just 1]
Breakpoint 0 activated at print029.hs:7:0-13
Stopped at print029.hs:7:0-13
_result :: (t Int, t Int) = _
Stopped at print029.hs:7:9-13
_result :: (t Int, t Int) = _
x :: [Maybe Int] = [Just 1]
y :: [Maybe Int] = _
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment