diff options
author | Jan Stolarek <jan.stolarek@p.lodz.pl> | 2016-01-09 20:58:52 +0100 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2016-01-09 20:58:54 +0100 |
commit | fbd6de2f0761b63a5f0a88ce0590f515d63790a4 (patch) | |
tree | c3bf647973fb4b675731a27d15af9919cd29d9e2 /testsuite/tests | |
parent | 5cb236dd6b497da0b9072b20ca74c298477f7a61 (diff) | |
download | haskell-fbd6de2f0761b63a5f0a88ce0590f515d63790a4.tar.gz |
Add InjectiveTypeFamilies language extension
Previously injective type families were part of TypeFamilies.
Now they are in a separate language extension.
Test Plan: ./validate
Reviewers: austin, bgamari, goldfire
Reviewed By: bgamari
Subscribers: goldfire, thomie
Differential Revision: https://phabricator.haskell.org/D1750
GHC Trac Issues: #11381
Diffstat (limited to 'testsuite/tests')
18 files changed, 33 insertions, 17 deletions
diff --git a/testsuite/tests/driver/T11381.hs b/testsuite/tests/driver/T11381.hs new file mode 100644 index 0000000000..8dc94dd8a7 --- /dev/null +++ b/testsuite/tests/driver/T11381.hs @@ -0,0 +1,9 @@ +{-# LANGUAGE TypeFamilies #-} + +module T11381 where + +-- ensure that this code does not compile without InjectiveTypeFamilies and that +-- injectivity error is not reported. +type family F a = r | r -> a +type instance F Int = Bool +type instance F Int = Char diff --git a/testsuite/tests/driver/T11381.stderr b/testsuite/tests/driver/T11381.stderr new file mode 100644 index 0000000000..afe652d38e --- /dev/null +++ b/testsuite/tests/driver/T11381.stderr @@ -0,0 +1,5 @@ + +T11381.hs:7:23: + Illegal injectivity annotation + Use InjectiveTypeFamilies to allow this + In the type family declaration for âFâ diff --git a/testsuite/tests/driver/T4437.hs b/testsuite/tests/driver/T4437.hs index 5f14da1a9a..cbf71868bd 100644 --- a/testsuite/tests/driver/T4437.hs +++ b/testsuite/tests/driver/T4437.hs @@ -38,7 +38,8 @@ check title expected got expectedGhcOnlyExtensions :: [String] expectedGhcOnlyExtensions = ["RelaxedLayout", "AlternativeLayoutRule", - "AlternativeLayoutRuleTransitional"] + "AlternativeLayoutRuleTransitional", + "InjectiveTypeFamilies"] expectedCabalOnlyExtensions :: [String] expectedCabalOnlyExtensions = ["Generics", diff --git a/testsuite/tests/driver/all.T b/testsuite/tests/driver/all.T index 8493aa4c57..e0022d7d60 100644 --- a/testsuite/tests/driver/all.T +++ b/testsuite/tests/driver/all.T @@ -466,3 +466,4 @@ test('T10970', normal, compile_and_run, ['-hide-all-packages -package base -pack test('T10970a', normal, compile_and_run, ['']) test('T4931', normal, compile_and_run, ['']) test('T11182', normal, compile_and_run, ['']) +test('T11381', normal, compile_fail, ['']) diff --git a/testsuite/tests/ghci/scripts/T6018ghci.script b/testsuite/tests/ghci/scripts/T6018ghci.script index 4615be2d04..3b14bd3467 100644 --- a/testsuite/tests/ghci/scripts/T6018ghci.script +++ b/testsuite/tests/ghci/scripts/T6018ghci.script @@ -1,4 +1,4 @@ -:set -XTypeFamilies +:set -XInjectiveTypeFamilies :set -XDataKinds :set -XUndecidableInstances :set -XPolyKinds diff --git a/testsuite/tests/ghci/scripts/T6018ghcifail.script b/testsuite/tests/ghci/scripts/T6018ghcifail.script index c0e073457f..0e6fe65033 100644 --- a/testsuite/tests/ghci/scripts/T6018ghcifail.script +++ b/testsuite/tests/ghci/scripts/T6018ghcifail.script @@ -1,4 +1,4 @@ -:set -XTypeFamilies +:set -XInjectiveTypeFamilies :set -XDataKinds :set -XUndecidableInstances :set -XPolyKinds diff --git a/testsuite/tests/ghci/scripts/T6018ghcirnfail.script b/testsuite/tests/ghci/scripts/T6018ghcirnfail.script index f1a5fa469a..1f3372ebac 100644 --- a/testsuite/tests/ghci/scripts/T6018ghcirnfail.script +++ b/testsuite/tests/ghci/scripts/T6018ghcirnfail.script @@ -1,4 +1,4 @@ -:set -XTypeFamilies +:set -XInjectiveTypeFamilies :set -XDataKinds :set -XUndecidableInstances :set -XPolyKinds diff --git a/testsuite/tests/th/T6018th.hs b/testsuite/tests/th/T6018th.hs index 62af743835..1643e9aea5 100644 --- a/testsuite/tests/th/T6018th.hs +++ b/testsuite/tests/th/T6018th.hs @@ -1,5 +1,5 @@ -{-# LANGUAGE TypeFamilies, DataKinds, UndecidableInstances, PolyKinds #-} - +{-# LANGUAGE InjectiveTypeFamilies, DataKinds, UndecidableInstances, + PolyKinds #-} module T6018th where import Language.Haskell.TH diff --git a/testsuite/tests/th/T8884.hs b/testsuite/tests/th/T8884.hs index 4255f76a4d..cad38f9de1 100644 --- a/testsuite/tests/th/T8884.hs +++ b/testsuite/tests/th/T8884.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE TemplateHaskell, TypeFamilies, PolyKinds #-} +{-# LANGUAGE TemplateHaskell, InjectiveTypeFamilies, PolyKinds #-} module T8884 where diff --git a/testsuite/tests/typecheck/should_compile/T6018.hs b/testsuite/tests/typecheck/should_compile/T6018.hs index 523bc968d0..62894c791a 100644 --- a/testsuite/tests/typecheck/should_compile/T6018.hs +++ b/testsuite/tests/typecheck/should_compile/T6018.hs @@ -1,7 +1,7 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE PolyKinds #-} -{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE InjectiveTypeFamilies #-} {-# LANGUAGE UndecidableInstances #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE NoMonomorphismRestriction #-} diff --git a/testsuite/tests/typecheck/should_compile/T6018.hs-boot b/testsuite/tests/typecheck/should_compile/T6018.hs-boot index e31903a312..d1cb0687cc 100644 --- a/testsuite/tests/typecheck/should_compile/T6018.hs-boot +++ b/testsuite/tests/typecheck/should_compile/T6018.hs-boot @@ -1,4 +1,4 @@ -{-# LANGUAGE TypeFamilies, PolyKinds #-} +{-# LANGUAGE InjectiveTypeFamilies, PolyKinds #-} module T6018 where diff --git a/testsuite/tests/typecheck/should_compile/T6018a.hs b/testsuite/tests/typecheck/should_compile/T6018a.hs index beecb57c65..e1e40bb790 100644 --- a/testsuite/tests/typecheck/should_compile/T6018a.hs +++ b/testsuite/tests/typecheck/should_compile/T6018a.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE InjectiveTypeFamilies #-} module T6018a where diff --git a/testsuite/tests/typecheck/should_fail/T10836.hs b/testsuite/tests/typecheck/should_fail/T10836.hs index 00c5c6a650..3ad2093c92 100644 --- a/testsuite/tests/typecheck/should_fail/T10836.hs +++ b/testsuite/tests/typecheck/should_fail/T10836.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE InjectiveTypeFamilies #-} module T10836 where type family Foo a = r | r -> a where diff --git a/testsuite/tests/typecheck/should_fail/T6018Afail.hs b/testsuite/tests/typecheck/should_fail/T6018Afail.hs index 95184a177c..d0cc076ac6 100644 --- a/testsuite/tests/typecheck/should_fail/T6018Afail.hs +++ b/testsuite/tests/typecheck/should_fail/T6018Afail.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE InjectiveTypeFamilies #-} module T6018Afail where diff --git a/testsuite/tests/typecheck/should_fail/T6018Bfail.hs b/testsuite/tests/typecheck/should_fail/T6018Bfail.hs index ef2460187f..2b7b442769 100644 --- a/testsuite/tests/typecheck/should_fail/T6018Bfail.hs +++ b/testsuite/tests/typecheck/should_fail/T6018Bfail.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE InjectiveTypeFamilies #-} module T6018Bfail where diff --git a/testsuite/tests/typecheck/should_fail/T6018fail.hs b/testsuite/tests/typecheck/should_fail/T6018fail.hs index ead4dd354f..8531c13d9a 100644 --- a/testsuite/tests/typecheck/should_fail/T6018fail.hs +++ b/testsuite/tests/typecheck/should_fail/T6018fail.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE TypeFamilies, DataKinds, UndecidableInstances, PolyKinds, +{-# LANGUAGE InjectiveTypeFamilies, DataKinds, UndecidableInstances, PolyKinds, MultiParamTypeClasses, FlexibleInstances #-} module T6018fail where diff --git a/testsuite/tests/typecheck/should_fail/T6018failclosed.hs b/testsuite/tests/typecheck/should_fail/T6018failclosed.hs index a69c63f7e5..eed5d033fb 100644 --- a/testsuite/tests/typecheck/should_fail/T6018failclosed.hs +++ b/testsuite/tests/typecheck/should_fail/T6018failclosed.hs @@ -1,5 +1,5 @@ -{-# LANGUAGE TypeFamilies, DataKinds, PolyKinds, UndecidableInstances #-} - +{-# LANGUAGE InjectiveTypeFamilies, DataKinds, PolyKinds, + UndecidableInstances #-} module T6018failclosed where -- Id is injective... diff --git a/testsuite/tests/typecheck/should_fail/T6018failclosed2.hs b/testsuite/tests/typecheck/should_fail/T6018failclosed2.hs index d90b9decfc..323b16fde3 100644 --- a/testsuite/tests/typecheck/should_fail/T6018failclosed2.hs +++ b/testsuite/tests/typecheck/should_fail/T6018failclosed2.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE InjectiveTypeFamilies #-} module T6018failclosed2 where |