Updated bug list & started working on more tests

This commit is contained in:
sebastianselander 2023-03-06 13:04:07 +01:00
parent f5b5f11903
commit 6947614fba
11 changed files with 80 additions and 59 deletions

View file

@ -3,15 +3,15 @@
module Main where
-- import Codegen.Codegen (compile)
import Grammar.ErrM (Err)
import Grammar.Par (myLexer, pProgram)
import Grammar.Print (printTree)
import Grammar.ErrM (Err)
import Grammar.Par (myLexer, pProgram)
import Grammar.Print (printTree)
-- import LambdaLifter.LambdaLifter (lambdaLift)
import Renamer.Renamer (rename)
import System.Environment (getArgs)
import System.Exit (exitFailure, exitSuccess)
import TypeChecker.TypeChecker (typecheck)
import Renamer.Renamer (rename)
import System.Environment (getArgs)
import System.Exit (exitFailure, exitSuccess)
import TypeChecker.TypeChecker (typecheck)
main :: IO ()
main =

View file

@ -1,8 +1,22 @@
## Bugs
### Polymorphic type variables are global?
None known at this moment
## Fixed bugs
* 1
```hs
fmap : ('a -> 'b) -> Maybe ('a) -> Maybe ('b) ;
fmap f x =
case x of {
Just x => Just (f x) ;
Nothing => Nothing
}
```
* 2
This doesn't work (occurs check failed, can't unify `(a -> a) = a`
```hs
data Maybe ('a) where {
Nothing : Maybe ('a)
@ -29,16 +43,3 @@ id x = x ;
main : Maybe ('a -> 'a) ;
main = Just id;
```
UPDATE: Might have found a fix. Need to be tested.
### The function f is not carried into the case-expression
Code example that does not type check
```hs
fmap : ('a -> 'b) -> Maybe ('a) -> Maybe ('b) ;
fmap f x =
case x of {
Just x => Just (f x) ;
Nothing => Nothing
}
```

View file

@ -61,7 +61,7 @@ freshenData (Data (Constr name ts) constrs) = do
where
freshenType :: Ident -> Type -> Type
freshenType iden = \case
(TPol a) -> TPol iden
(TPol _) -> TPol iden
(TArr a b) -> TArr (freshenType iden a) (freshenType iden b)
(TConstr (Constr a ts)) ->
TConstr (Constr a (map (freshenType iden) ts))