This commit is contained in:
Dima 2021-09-09 15:53:13 +03:00 committed by GitHub
parent 91038851a5
commit 49da2a07ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 50 deletions

View File

@ -1,19 +1,5 @@
module Export.Test declares foobar, foo, bar, ExpSrv, FA
const FA = "constant"
func bar() -> string:
<- " I am MyFooBar bar"
-- exports3.aqua
module Export declares *
func foo() -> string:
<- "I am MyFooBar foo"
func foobar() -> []string:
res: *string
res <- foo()
res <- bar()
<- res
service ExpSrv("exp-srv"):
baz()
log: string -> ()
<- "I am MyFooBar foo"

View File

@ -1,32 +1,7 @@
-- import.aqua
module Import.Test
import foobar, FA as C, ExpSrv from "export.aqua"
use foo as f, FA as U from "export.aqua" as Exp
use foo as f, FA from "export.aqua" as Exp1
module Import
use "export.aqua"
import "gen/OneMore.aqua"
import OneMore as OM from "gen/OneMore.aqua"
export consts as main--, foobar as barfoo
func consts():
ExpSrv.log(C)
ExpSrv.log(Exp.U)
ExpSrv.log(Exp1.FA)
ExpSrv.log(Export.Test.FA)
func foo_wrapper() -> string:
z <- Exp.f()
q <- Export.Test.bar()
OneMore "hello"
OneMore.more_call()
OM "ohmygod"
OM.more_call()
OM.consume(q)
ExpSrv.log(C)
ExpSrv.log(Exp.U)
<- z
z <- Export.foo()
<- z

View File

@ -120,13 +120,13 @@ object HeaderSem {
),
(ctx, _) =>
// When file is handled, check that all the declarations exists
if (declareAll.nonEmpty)
if (declareAll.nonEmpty) {
val all =
ctx.`type`("").map(_.fields.toNel.map(_._1).toList.toSet).getOrElse(Set.empty)
validNec(
ctx.copy(declares =
ctx.`type`("").map(_.fields.toNel.map(_._1).toList.toSet).getOrElse(Set.empty)
)
ctx.copy(module = Some(name.value), declares = all)
)
else
} else
(
declareNames.map(n => n.value -> n) ::: declareCustom.map(a => a.value -> a)
).map[ValidatedNec[SemanticError[S], Int]] { case (n, t) =>