on master help sign in
Merge pull request #321 from Sheeo/sourcesyntax-matches

Incomplete matches in sourcesyntax

commit5bde7cf4b56335b883536fcaf52438dd208a24dd authorEvan Czaplicki <info@elm-lang.org> dateMon 11 Nov 2013, 06:29 (13 years ago) parent4b480a9158c70e
3 files changed+12−5
compiler/SourceSyntax/Declaration.hs+4−3 compiler/SourceSyntax/Module.hs+6−1 compiler/SourceSyntax/Type.hs+2−1
compiler/SourceSyntax/Declaration.hs+4−3
@@ -43,6 +43,7 @@ instance Pretty (Declaration t v) where
4343 let alias = P.text name <+> P.hsep (map P.text tvars) in
4444 P.hang (P.text "type" <+> alias <+> P.equals) 4 (pretty tipe)
4545
46− -- TODO: actually write out the other cases. They are currently unused, but
47− -- this is probably going to be a bug someday.
48− _ -> P.text (show decl)
46+ -- TODO: Actually write out the contained data in these cases.
47+ ImportEvent _ _ _ _ -> P.text (show decl)
48+ ExportEvent _ _ _ -> P.text (show decl)
49+ Fixity _ _ _ -> P.text (show decl)
compiler/SourceSyntax/Module.hs+6−1
@@ -42,6 +42,7 @@ instance Binary ImportMethod where
4242 0 -> liftM As get
4343 1 -> liftM Importing get
4444 2 -> liftM Hiding get
45+ _ -> error "Error reading valid ImportMethod type from serialized string"
4546
4647data MetadataModule t v = MetadataModule {
4748 names :: [String],
@@ -83,6 +84,10 @@ instance Binary ModuleInterface where
8384
8485instance Binary Assoc where
8586 get = do n <- getWord8
86− return $ case n of { 0 -> L ; 1 -> N ; 2 -> R }
87+ return $ case n of
88+ 0 -> L
89+ 1 -> N
90+ 2 -> R
91+ _ -> error "Error reading valid associativity from serialized string"
8792
8893 put assoc = putWord8 $ case assoc of { L -> 0 ; N -> 1 ; R -> 2 }
compiler/SourceSyntax/Type.hs+2−1
@@ -93,4 +93,5 @@ instance Binary Type where
9393 1 -> Var <$> get
9494 2 -> Data <$> get <*> get
9595 3 -> return EmptyRecord
96− 4 -> Record <$> get <*> get
96+ 4 -> Record <$> get <*> get
97+ _ -> error "Error reading a valid type from serialized string"