From: Matthijs Kooijman Date: Wed, 3 Mar 2010 10:21:53 +0000 (+0100) Subject: Make getFieldLabels errors more verbose. X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=2090dc06c1a4c475ff8220254940f6a468888e57;p=matthijs%2Fmaster-project%2Fc%CE%BBash.git Make getFieldLabels errors more verbose. --- diff --git "a/c\316\273ash/CLasH/VHDL/VHDLTools.hs" "b/c\316\273ash/CLasH/VHDL/VHDLTools.hs" index 263d364..7ac35a4 100644 --- "a/c\316\273ash/CLasH/VHDL/VHDLTools.hs" +++ "b/c\316\273ash/CLasH/VHDL/VHDLTools.hs" @@ -531,9 +531,10 @@ getFieldLabels ty = do -- Assume the type for which we want labels is really translatable htype <- mkHType error_msg ty case Map.lookup htype types of - Just (Just (_, Just (Left (AST.TDR (AST.RecordTypeDef elems))))) -> return $ map (\(AST.ElementDec id _) -> id) elems + Nothing -> error $ "\nVHDLTools.getFieldLabels: Type not found? This should not happen!\nLooking for type: " ++ (pprString ty) ++ "\nhtype: " ++ (show htype) Just Nothing -> return [] -- The type is empty - _ -> error $ "\nVHDLTools.getFieldLabels: Type not found or not a record type? This should not happen! Type: " ++ (show htype) + Just (Just (_, Just (Left (AST.TDR (AST.RecordTypeDef elems))))) -> return $ map (\(AST.ElementDec id _) -> id) elems + Just (Just (_, Just vty)) -> error $ "\nVHDLTools.getFieldLabels: Type not a record type? This should not happen!\nLooking for type: " ++ pprString (ty) ++ "\nhtype: " ++ (show htype) ++ "\nFound type: " ++ (show vty) mktydecl :: (AST.VHDLId, Maybe (Either AST.TypeDef AST.SubtypeIn)) -> Maybe AST.PackageDecItem mytydecl (_, Nothing) = Nothing