Skip to content

Commit

Permalink
[ #20 ] More basic works
Browse files Browse the repository at this point in the history
  • Loading branch information
ice1000 committed Dec 20, 2018
1 parent bb3cd73 commit f49fb3b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/full/OwO/TypeChecking.hs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,13 @@ import OwO.TypeChecking.Reduce
typeCheck :: TCEnv -> PsiTerm -> Either TCErr Term
typeCheck env (PsiConstant _ info) = Right $ Constant info
typeCheck env (PsiLambda binder term) = return __TODO__
typeCheck env (PsiReference name) = return __TODO__
typeCheck env (PsiReference name) =
case lookupCtxWithName
(envModuleName env)
(textOfName name)
(envDefinitions env) of
Nothing -> Left $ UnresolvedReferenceErr name
Just def -> Right $ Ref FunctionName name def
typeCheck env term = return __TODO__

typeCheckFile :: TCState -> PsiFile -> TCM ()
Expand Down
2 changes: 1 addition & 1 deletion src/full/OwO/TypeChecking/Core.hs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ data Term' i
-- ^ Application
| Var !Int
-- ^ A variable resolved with de bruijn index
| Param NameType i (Term' i)
| Ref NameType i Definition
-- ^ Named reference, might be external definitions
| Bind i !(BinderInfo (Term' i)) (Term' i)
-- ^ Name binding
Expand Down
2 changes: 2 additions & 0 deletions src/full/OwO/TypeChecking/Monad.hs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ data TCEnv = TypeCheckingEnv
-- ^ This is passed all around
, envDefinitions :: TCCtx Definition
-- ^ Local definitions
, envModuleName :: QModuleName
-- ^ Current module name
} deriving (Generic, Show)

data TCErr' t
Expand Down

0 comments on commit f49fb3b

Please sign in to comment.