Commit 1d2ffb6a authored by Jan Stolarek's avatar Jan Stolarek

Validate inferred theta. Fixes #8883

This checks that all the required extensions are enabled for the
inferred type signature.

Updates binary and vector submodules.
parent 41f5b7e3
......@@ -2,6 +2,7 @@
-- | This is the top-level module in the LLVM code generator.
--
{-# LANGUAGE TypeFamilies #-}
module LlvmCodeGen ( llvmCodeGen, llvmFixupAsm ) where
#include "HsVersions.h"
......
......@@ -5,6 +5,7 @@
-- (c) The University of Glasgow 2004-2013
--
-----------------------------------------------------------------------------
{-# LANGUAGE FlexibleContexts, TypeFamilies #-}
module RegAlloc.Liveness (
RegSet,
RegMap, emptyRegMap,
......
......@@ -9,6 +9,7 @@
#include "HsVersions.h"
#include "nativeGen/NCG.h"
{-# LANGUAGE TypeFamilies #-}
module X86.Instr (Instr(..), Operand(..), PrefetchVariant(..), JumpDest,
getJumpDestBlockId, canShortcut, shortcutStatics,
shortcutJump, i386_insert_ffrees, allocMoreStack,
......
......@@ -54,6 +54,7 @@ import FastString
import Type(mkStrLitTy)
import Class(classTyCon)
import PrelNames(ipClassName)
import TcValidity (checkValidTheta)
import Control.Monad
......@@ -562,6 +563,10 @@ tcPolyInfer rec_tc prag_fn tc_sig_fn mono closed bind_list
simplifyInfer closed mono name_taus wanted
; theta <- zonkTcThetaType (map evVarPred givens)
-- We need to check inferred theta for validity. The reason is that we
-- might have inferred theta that requires language extension that is
-- not turned on. See #8883. Example can be found in the T8883 testcase.
; checkValidTheta (InfSigCtxt (fst . head $ name_taus)) theta
; exports <- checkNoErrs $ mapM (mkExport prag_fn qtvs theta) mono_infos
; loc <- getSrcSpanM
......
\begin{code}
-- Type definitions for the constraint solver
{-# LANGUAGE TypeFamilies #-}
module TcSMonad (
-- Canonical constraints, definition is now in TcRnTypes
......
Subproject commit 2799c25d85b4627200f2e4dcb30d2128488780c3
Subproject commit 2647d42f19bedae46c020fc3af029073f5690d5b
Subproject commit 9baab444a57c4a225ee247fea27187d1892d90bf
Subproject commit a6049abce040713e9a5f175887cf70d12b9057c6
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeFamilies, FlexibleContexts #-}
module ColInference6 where
......
......@@ -2,6 +2,8 @@
-- This used lots of memory, and took a long time to compile, with GHC 6.12:
-- http://www.haskell.org/pipermail/glasgow-haskell-users/2010-May/018835.html
{-# LANGUAGE FlexibleContexts, TypeFamilies #-}
module IndTypesPerf where
import IndTypesPerfMerge
......
{-# LANGUAGE EmptyDataDecls, TypeFamilies, UndecidableInstances,
ScopedTypeVariables, OverlappingInstances, TypeOperators,
FlexibleInstances, NoMonomorphismRestriction,
MultiParamTypeClasses #-}
MultiParamTypeClasses, FlexibleContexts #-}
module IndTypesPerfMerge where
data a :* b = a :* b
......
{-# LANGUAGE UnicodeSyntax #-}
{-# LANGUAGE UnicodeSyntax, FlexibleContexts #-}
module Main (main) where
......
{-# LANGUAGE UnicodeSyntax #-}
{-# LANGUAGE UnicodeSyntax, FlexibleContexts #-}
module Main (main) where
......
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE BangPatterns, FlexibleContexts #-}
module Main where
import Data.Array.Base (unsafeRead, unsafeWrite)
......
{-# LANGUAGE RebindableSyntax, MultiParamTypeClasses,
FlexibleInstances #-}
FlexibleInstances, FlexibleContexts #-}
-- Tests of the do-notation for the restricted monads
-- We demonstrate that all ordinary monads are restricted monads,
......
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE MultiParamTypeClasses, FlexibleContexts #-}
-- We want to get the type
-- g :: forall a b c. C a (b,c) => a -> b
......
{-# OPTIONS_GHC -ddump-types #-}
{-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies #-}
{-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies, FlexibleContexts #-}
-- See Trac #1456
......
{-# LANGUAGE TypeFamilies #-}
-- Trac #8883
module T8883 where
type family PF a :: * -> *
class Regular a where
from :: a -> PF a a
-- For fold we infer following type signature:
--
-- fold :: (Functor (PF a), Regular a) => (PF a b -> b) -> a -> b
--
-- However, this signature requires FlexibleContexts since the first
-- type-class constraint is not of the form (class type-variable) nor
-- (class (type-variable type1 type2 ... typen)). Since this extension
-- is not enabled compilation should fail.
fold f = f . fmap (fold f) . from
T8883.hs:17:1:
Non type-variable argument in the constraint: Functor (PF a)
(Use FlexibleContexts to permit this)
In the context: (Regular a, Functor (PF a))
While checking the inferred type for ‘fold’
{-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies,
FlexibleInstances, UndecidableInstances #-}
FlexibleInstances, UndecidableInstances, FlexibleContexts #-}
-- UndecidableInstances now needed because the Coverage Condition fails
module ShouldFail where
......
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