diff options
author | Krzysztof Gogolewski <krzysztof.gogolewski@tweag.io> | 2022-05-14 01:07:36 +0200 |
---|---|---|
committer | Krzysztof Gogolewski <krzysztof.gogolewski@tweag.io> | 2022-05-27 16:44:48 +0200 |
commit | 3bd7d5d668b316f517a66c72fcf9bc7a36cc6ba4 (patch) | |
tree | 186c133c0259d87f04b79c2017b7ee858b1b380a /testsuite/tests/simplCore | |
parent | ed37027f713bb6563fd98d144a39211339fd91a5 (diff) | |
download | haskell-3bd7d5d668b316f517a66c72fcf9bc7a36cc6ba4.tar.gz |
Use a class to check validity of withDictwip/withdict
This moves handling of the magic 'withDict' function from the desugarer
to the typechecker. Details in Note [withDict].
I've extracted a part of T16646Fail to a separate file T16646Fail2,
because the new error in 'reify' hides the errors from 'f' and 'g'.
WithDict now works with casts, this fixes #21328.
Part of #19915
Diffstat (limited to 'testsuite/tests/simplCore')
-rw-r--r-- | testsuite/tests/simplCore/should_run/T21575.hs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/testsuite/tests/simplCore/should_run/T21575.hs b/testsuite/tests/simplCore/should_run/T21575.hs index 976483f963..d1b383ec1a 100644 --- a/testsuite/tests/simplCore/should_run/T21575.hs +++ b/testsuite/tests/simplCore/should_run/T21575.hs @@ -31,7 +31,7 @@ main = do toJSONBar :: Given Style => Bar -> Value give Normal (\gd -> toJSONBar gd e) - --> withDict @Style @(Given Style) Normal (toJSON e) + --> withDict @(Given Style) @Style Normal (toJSON e) --> toJSONBar ((Normal |> co) :: Given Style) e give Normal (\gd -> toJSONBar gd e') @@ -40,7 +40,7 @@ toJSONBar :: Given Style => Bar -> Value --------- With new cast ------------ give Normal (\gd -> toJSONBar gd e) - --> withDict @Style @(Given Style) Normal (\gd -> toJSONBar gd e) + --> withDict @(Given Style) @Style Normal (\gd -> toJSONBar gd e) --> ((\gd -> toJSONBar gd e) |> co) Normal --> (\gd' -> toJSonBar (gd' |> sym (co[1])) e) Normal --> toJSONBar (Normal |> co') e -- Boo! @@ -61,7 +61,7 @@ class Given a where give :: forall a r. a -> (Given a => r) -> r #if WITH_DICT -give = withDict @a @(Given a) +give = withDict @(Given a) @a #else give a k = unsafeCoerce (Gift k :: Gift a r) a |