summaryrefslogtreecommitdiff
path: root/compiler/vectorise
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2016-07-01 22:33:33 +0100
committerSimon Peyton Jones <simonpj@microsoft.com>2016-07-05 13:54:54 +0100
commit85aa6ef09346e841abf4e089b24c7f783286cd74 (patch)
tree7ed14c467fb650479acb542d001a74f688948d0e /compiler/vectorise
parente10497b9a3622265b88caa60590ed620ff3d33e2 (diff)
downloadhaskell-85aa6ef09346e841abf4e089b24c7f783286cd74.tar.gz
Check generic-default method for ambiguity
Fixes Trac #7497 and #12151. In some earlier upheaval I introduced a bug in the ambiguity check for genreric-default method. This patch fixes it. But in fixing it I realised that the sourc-location of any such error message was bogus, so I fixed that too, which involved a slightly wider change; see the comments with TcMethInfo.
Diffstat (limited to 'compiler/vectorise')
-rw-r--r--compiler/vectorise/Vectorise/Type/TyConDecl.hs9
1 files changed, 9 insertions, 0 deletions
diff --git a/compiler/vectorise/Vectorise/Type/TyConDecl.hs b/compiler/vectorise/Vectorise/Type/TyConDecl.hs
index a75391eca5..7aa79215d5 100644
--- a/compiler/vectorise/Vectorise/Type/TyConDecl.hs
+++ b/compiler/vectorise/Vectorise/Type/TyConDecl.hs
@@ -13,6 +13,8 @@ import Type
import TyCon
import DataCon
import DynFlags
+import BasicTypes( DefMethSpec(..) )
+import SrcLoc( SrcSpan, noSrcSpan )
import Var
import Name
import Outputable
@@ -124,6 +126,13 @@ vectMethod id defMeth ty
; return (Var.varName id', ty', defMethSpecOfDefMeth defMeth)
}
+-- | Convert a `DefMethInfo` to a `DefMethSpec`, which discards the name field in
+-- the `DefMeth` constructor of the `DefMeth`.
+defMethSpecOfDefMeth :: DefMethInfo -> Maybe (DefMethSpec (SrcSpan, Type))
+defMethSpecOfDefMeth Nothing = Nothing
+defMethSpecOfDefMeth (Just (_, VanillaDM)) = Just VanillaDM
+defMethSpecOfDefMeth (Just (_, GenericDM ty)) = Just (GenericDM (noSrcSpan, ty))
+
-- |Vectorise the RHS of an algebraic type.
--
vectAlgTyConRhs :: TyCon -> AlgTyConRhs -> VM AlgTyConRhs