mirror of
https://github.com/anoma/juvix.git
synced 2024-10-26 17:52:17 +03:00
parent
366afb5dad
commit
9fdf848e3e
@ -48,11 +48,16 @@ checkModuleNoCache ::
|
||||
Sem r Module
|
||||
checkModuleNoCache (ModuleIndex Module {..}) = do
|
||||
_moduleBody' <-
|
||||
(evalState (mempty :: NegativeTypeParameters) . checkModuleBody) _moduleBody
|
||||
evalState (mempty :: NegativeTypeParameters)
|
||||
. checkModuleBody
|
||||
$ _moduleBody
|
||||
_moduleExamples <- mapM checkExample _moduleExamples
|
||||
return
|
||||
Module
|
||||
{ _moduleBody = _moduleBody',
|
||||
..
|
||||
_moduleName,
|
||||
_moduleExamples,
|
||||
_modulePragmas
|
||||
}
|
||||
|
||||
checkModuleBody ::
|
||||
@ -60,8 +65,8 @@ checkModuleBody ::
|
||||
ModuleBody ->
|
||||
Sem r ModuleBody
|
||||
checkModuleBody ModuleBody {..} = do
|
||||
_moduleStatements' <- mapM checkStatement _moduleStatements
|
||||
_moduleImports' <- mapM checkImport _moduleImports
|
||||
_moduleStatements' <- mapM checkStatement _moduleStatements
|
||||
return
|
||||
ModuleBody
|
||||
{ _moduleStatements = _moduleStatements',
|
||||
|
@ -422,7 +422,7 @@ addIdens idens = do
|
||||
functionDefEval :: forall r'. Member (State FunctionsTable) r' => FunctionDef -> Sem r' (Maybe Expression)
|
||||
functionDefEval = runFail . goTop
|
||||
where
|
||||
goTop :: forall r. (Members '[Fail, State FunctionsTable] r) => FunctionDef -> Sem r Expression
|
||||
goTop :: forall r. Members '[Fail, State FunctionsTable] r => FunctionDef -> Sem r Expression
|
||||
goTop f =
|
||||
case f ^. funDefClauses of
|
||||
c :| [] -> goClause c
|
||||
@ -458,7 +458,7 @@ functionDefEval = runFail . goTop
|
||||
go :: [(PatternArg, Expression)] -> Sem r Expression
|
||||
go = \case
|
||||
[] -> return (c ^. clauseBody)
|
||||
((p, ty) : ps)
|
||||
(p, ty) : ps
|
||||
| Implicit <- p ^. patternArgIsImplicit -> fail
|
||||
| otherwise -> go ps >>= goPattern (p ^. patternArgPattern, ty)
|
||||
|
||||
|
@ -236,7 +236,11 @@ tests =
|
||||
posTest
|
||||
"Nested pattern match with type variables"
|
||||
$(mkRelDir ".")
|
||||
$(mkRelFile "NestedPatterns.juvix")
|
||||
$(mkRelFile "NestedPatterns.juvix"),
|
||||
posTest
|
||||
"issue2248: Import type alias"
|
||||
$(mkRelDir "issue2248")
|
||||
$(mkRelFile "Main.juvix")
|
||||
]
|
||||
<> [ compilationTest t | t <- Compilation.tests
|
||||
]
|
||||
|
8
tests/positive/issue2248/Bug.juvix
Normal file
8
tests/positive/issue2248/Bug.juvix
Normal file
@ -0,0 +1,8 @@
|
||||
module Bug;
|
||||
|
||||
type A := mkA : A;
|
||||
|
||||
aliasA : Type;
|
||||
aliasA := A;
|
||||
|
||||
type C := mkC : aliasA -> C;
|
5
tests/positive/issue2248/Main.juvix
Normal file
5
tests/positive/issue2248/Main.juvix
Normal file
@ -0,0 +1,5 @@
|
||||
module Main;
|
||||
|
||||
import Bug open;
|
||||
|
||||
c : C := mkC mkA;
|
4
tests/positive/issue2248/juvix.yaml
Normal file
4
tests/positive/issue2248/juvix.yaml
Normal file
@ -0,0 +1,4 @@
|
||||
dependencies:
|
||||
- .juvix-build/stdlib/
|
||||
name: issue2248
|
||||
version: 0.0.0
|
Loading…
Reference in New Issue
Block a user