Commit 242037ad authored by Finn Teegen's avatar Finn Teegen

Fix bug with generated default implementations of nullary class methods

parent 8bc3e560
...@@ -5,6 +5,7 @@ Version 1.0.2 (under development) ...@@ -5,6 +5,7 @@ Version 1.0.2 (under development)
============= =============
* Fixed bug with wrong type of free variables in the intermediate language. * Fixed bug with wrong type of free variables in the intermediate language.
* Fixed bug with generated default implementations of nullary class methods.
Version 1.0.1 Version 1.0.1
============= =============
......
...@@ -413,10 +413,12 @@ defaultClassMethodDecl :: QualIdent -> Ident -> DTM (Decl PredType) ...@@ -413,10 +413,12 @@ defaultClassMethodDecl :: QualIdent -> Ident -> DTM (Decl PredType)
defaultClassMethodDecl cls f = do defaultClassMethodDecl cls f = do
pty@(PredType _ ty) <- getClassMethodType cls f pty@(PredType _ ty) <- getClassMethodType cls f
augEnv <- getAugEnv augEnv <- getAugEnv
let pats = if isAugmented augEnv (qualifyLike cls f) let augmented = isAugmented augEnv (qualifyLike cls f)
pats = if augmented
then [ConstructorPattern predUnitType qUnitId []] then [ConstructorPattern predUnitType qUnitId []]
else [] else []
return $ funDecl NoPos pty f pats $ preludeError (instType ty) $ ty' = if augmented then arrowBase ty else ty
return $ funDecl NoPos pty f pats $ preludeError (instType ty') $
"No instance or default method for class operation " ++ escName f "No instance or default method for class operation " ++ escName f
getClassMethodType :: QualIdent -> Ident -> DTM PredType getClassMethodType :: QualIdent -> Ident -> DTM PredType
......
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