Commit fa13c136 authored by Richard Eisenberg's avatar Richard Eisenberg
Browse files

Fix #13202 by failing more eagerly in tcRnStmt

test cases: ghci/scripts/T13202{,a}
parent dca44adb
......@@ -1877,6 +1877,9 @@ tcRnStmt hsc_env rdr_stmt
zonked_expr <- zonkTopLExpr tc_expr ;
zonked_ids <- zonkTopBndrs bound_ids ;
failIfErrsM ; -- we can't do the next step if there are levity polymorphism errors
-- test case: ghci/scripts/T13202{,a}
-- None of the Ids should be of unboxed type, because we
-- cast them all to HValues in the end!
mapM_ bad_unboxed (filter (isUnliftedType . idType) zonked_ids) ;
......
import GHC.Exts
:set -XTypeApplications -XMagicHash -XTypeInType
data TypeRep (a :: k) = TypeRep
let typeRepKind = undefined :: TypeRep (a :: k) -> TypeRep k
let typeRep = undefined :: TypeRep (a :: k)
let x = typeRepKind (typeRep @(Maybe Int#))
<interactive>:6:22: error:
• Cannot apply expression of type ‘TypeRep a0’
to a visible type argument ‘(Maybe Int#)’
• In the first argument of ‘typeRepKind’, namely
‘(typeRep @(Maybe Int#))’
In the expression: typeRepKind (typeRep @(Maybe Int#))
In an equation for ‘x’: x = typeRepKind (typeRep @(Maybe Int#))
import GHC.Records
:set -XTypeApplications -XDataKinds
let foo = getField @"name"
<interactive>:3:5: error:
• Non type-variable argument in the constraint: HasField "name" r a
(Use FlexibleContexts to permit this)
• When checking the inferred type
foo :: forall r a. HasField "name" r a => r -> a
......@@ -248,3 +248,5 @@ test('T12447', expect_broken(12447), ghci_script, ['T12447.script'])
test('T10249', normal, ghci_script, ['T10249.script'])
test('T12550', normal, ghci_script, ['T12550.script'])
test('StaticPtr', normal, ghci_script, ['StaticPtr.script'])
test('T13202', normal, ghci_script, ['T13202.script'])
test('T13202a', normal, ghci_script, ['T13202a.script'])
Markdown is supported
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