Commit Graph

75 Commits

Author SHA1 Message Date
Dima
49729ac40a
fix(compiler): Ordering in option inliner [LNG-351] (#1114) 2024-04-08 09:24:55 +00:00
Dima
14748c7646
fix(compiler): Create restrictions in inliner [LNG-346] (#1099) 2024-03-28 11:10:13 +00:00
InversionSpaces
5c7f6a89c6
feat(compiler): Reimplement noXor compiler flag [LNG-347] (#1096)
* Fix imports

* Remove constants

* Return constants

* Refactor

* Add config

* Do not propagate errors

* Do not propagate errors through on

* Rename hop ephemeral streams

* Add comments

* Add tests
2024-03-05 10:45:21 +07:00
Dima
d7fef3db5f
fix(compiler): Bug in renaming [LNG-346] (#1094) 2024-02-29 09:23:34 +00:00
Dima
b22762ca6d
fix(compiler): Recursively find abilities [LNG-338] (#1086) 2024-02-21 14:11:21 +03:00
Dima
1a0b3a22c1
fix(compiler): Streams in closures generates wrong AIR (#1055) 2024-01-30 11:34:50 +03:00
Dima
abcb63db3b
perf(compiler): Inliner optimization [LNG-322] (#1047) 2024-01-22 10:08:06 +00:00
Dima
85f3ecdf39
fix(compiler): Add outside context to closures [LNG-317] (#1038) 2024-01-11 11:00:32 +03:00
Dima
5241f522d8
fix(compiler): Passing closures with abilities [LNG-314] (#1035) 2024-01-09 19:31:37 +03:00
InversionSpaces
ae32f80277
feat(compiler): for ... rec [LNG-307] (#1026)
* Add parser

* Add semantics

* Add inlining

* Add range test

* Rewrite to for ... rec

* Rewrite tests

* Fix import

* Add nested test

* Remove only

* Add yes|no test

* Add multi rec test

* Add pipeline test

* Unignore tests

* Change timeouts

* Add remote rec test

* Fix integration tests

* Add parser test

* Add semantics test

* Add inlining test

* Add comment
2024-01-09 12:48:02 +01:00
Dima
4cecab1a26
fix(compiler): Use correct empty stream as argument [LNG-280, LNG-292] (#967) 2023-11-28 10:45:12 +00:00
InversionSpaces
2d4b2aece4
fix(compiler): Allow returning resolved service as ability [LNG-266] (#977)
* Refactor

* Refactor type system

* Remove println

* Fix renaming

* Add unit tests

* Do not convert to call arrow

* Check ability

* Refactor captured values resolution

* Remove println

* Fix fields gathering

* Remove println

* Remove println

* Fix renaming, export ability

* Rename only abilities

* Fix unit tests

* Fix captured arrows renaming

* Add comments

* Refactor

* Rename only arrows

* Add comments, refactor

* Add comments

* Rename method

* Add integration test

---------

Co-authored-by: Anatolios Laskaris <github_me@nahsi.dev>
Co-authored-by: Dima <dmitry.shakhtarin@fluence.ai>
2023-11-23 10:12:44 +00:00
InversionSpaces
11c8970fd8
feat(compiler)!: Make nil option bottom [LNG-279] (#968)
* Make nil option of bottom

* Fix tests

* Make literals of data type

* Add unit tests

* Remove print
2023-11-14 11:02:58 +00:00
InversionSpaces
68425ed42a
feat(compiler)!: Prohibit mutating options [LNG-277] (#960)
* Parse any nested type

* Refactor type system

* Fix restriction

* Refactor type resolution

* Return stream definition

* Update examples

* Refactor

* Refactor

* Refactor integration tests

* Export service

* Add integration test

* Fix args provider

* Add parser unit tests

* Add type resolution unit tests

* Add more unit tests

* DataTypeToken -> CompositeTypeToken

* GeneralStreamType -> MutableStreamType

* Refactor

* Refactor TypeResolution

* colType -> collectionType

* Refactor

* Fix PushToStreamSem

* BasicTypeToken -> ScalarTypeToken

* CompositeTypeToken -> BasicTypeToken

* Fix for nil

* Make stream collectible

* Refactor collectible type

* Use internalError

* Add unit tests
2023-11-13 11:58:36 +03:00
Dima
a1576efad9
fix(compiler): Code generate wrong stream name in AIR [LNG-276] (#958) 2023-11-02 13:13:25 +00:00
InversionSpaces
78ee753c7b
feat(compiler): Always generate last argument of fold [LNG-265] (#947)
* Always generate last in fold

* Fix unit tests

* Add methods
2023-10-30 12:58:51 +03:00
Dima
38f77285f5
fix(compiler): Throw an error when comparing an alias and a named type with the same name [LNG-231] (#946) 2023-10-27 11:18:44 +00:00
Dima
45ca7bbf3e
fix(compiler): Multiple closures in one function [LNG-262] (#941) 2023-10-27 09:24:52 +02:00
Dima
fab46ee130
fix(compiler): Return ability arrow [LNG-258] (#935) 2023-10-23 16:59:55 +03:00
InversionSpaces
c83d69e689
fix(compiler): Passed function is not handled correctly [LNG-260] (#940)
* Fix renaming

* Add integration test
2023-10-23 11:54:09 +00:00
InversionSpaces
5f6c47ffea
feat(compiler): Optimize math in compile time [LNG-245] (#922)
* Move service calls for math to inlining

* Fix: add predo

* Introduce CallServiceRaw

* Add comment

* Add optimization to inlining

* Add tests

* map -> mapValues

* Refactor type

* Add optimization

* Add optimization test

* Fix unit tests

* Fix PR comments

* Restrict optimization

* Add substraction to optimization

* Apply optimizations in gate

* Fix sign, move optimization to unfold

* Fix type and tests

* Fix unit tests

* Add unit test

* Fix after merge

* Add optimization, fix unit tests

* Fix comment
2023-10-09 13:02:26 +03:00
InversionSpaces
b298eebf5e
fix(compiler): Fix gate inlining [LNG-253] (#924)
* Fix gate inlining

* Remake stream gate inlining, fix unit tests

* Fix: add flat inline

* Refactor, add comments
2023-10-08 12:52:54 +02:00
Dima
878990a837
feat: Create structs with stream maps [fixes LNG-244] (#893) 2023-09-27 15:07:22 +03:00
InversionSpaces
ca6cae96ad
feat(compiler): Make if propagate errors [fixes LNG-202] (#779)
* Change if inlining, add fail model

* Inline if

* Fix, add comments

* Add integration test

* Fix test

* Fix test

* toBe -> toEqual

---------

Co-authored-by: Dima <dmitry.shakhtarin@fluence.ai>
2023-09-27 09:52:52 +00:00
InversionSpaces
a80033b81c
feat(compiler): Replace %last_error% with :error: [fixes LNG-239] (#883)
* %last_error% -> :error:

* Add integration test

* Fix integration tests

* Update integration test
2023-09-26 13:28:13 +03:00
InversionSpaces
8741c910be
feat(compiler): Fail on internal error [fixes LNG-229] (#905)
* Refactor utils

* Add errors project

* logger.error -> internalError

* Add comment

* Suppress stack trace

---------

Co-authored-by: Dima <dmitry.shakhtarin@fluence.ai>
2023-09-19 17:01:42 +02:00
InversionSpaces
ed9e708939
fix(compiler): Fix arrows capture in closures [fixes LNG-242] (#903)
* Fix arrows capture

* Add comment

* Add test

* Add integration test
2023-09-19 14:25:11 +03:00
InversionSpaces
6be2a3d5da
feat(compiler): Services as abilities [fixes LNG-206] (#873)
* Refactor ServiceSem

* Refactor AbilityIdSem

* Remove tokens from state

* Refactor

* Add mangler

* Fix tests

* Refactor valueToRaw

* ServiceIdTag

* AbilityId -> ServiceId

* Add ServiceType

* Fix defineServiceType

* Refactor resolveArrowDef

* Refactor TypesHelper

* Add ServiceIdTag inlining

* Implement resolution

* Add service as ability passing

* Fix importing services

* Fix cli

* Implement default service

* Remove println

* Fix capture

* Add integration test

* Fix id

* Fix test

* Fix test

* Refactor test

* Do not resolve id

* Refactor FuncArrow creation

* Refactor FuncArrow wrapper creation

* Add named arguments

* Add comment

* ensureIsString -> valueToStringRaw, refactor OnSem

* Resolve services as abilities

* Add name to varNames

* Remove service hack

* Capture services, do not rename captured

* Rename arrows along with values

* Fix CallArrowRaw.map

* Fix unit tests

* Remove service case

* Refactor abilities state

* Propagate rootServiceIds

* Remove unused

* Add comments

* Refactor

* Refactor

* Add test

---------

Co-authored-by: Dima <dmitry.shakhtarin@fluence.ai>
2023-09-15 10:34:21 +02:00
InversionSpaces
443e65e3d8
fix(compiler): Fix closure stream capture [fixes LNG-58] (#857) 2023-09-01 16:05:32 +03:00
InversionSpaces
bf0b51fa5b
fix(compiler): Fix nested abilities [fixes LNG-220] (#852)
* Fix fields gathering

* Remove println

* Add test

* Remove println

* Add comments

* Add comments
2023-08-22 11:53:06 +02:00
Dima
8060695dbb
feat: parseq implementation (fixes LNG-223) (#840)
* parsec implementation

* add test code

* parsec expression

* Refactor

* Refactor

* Add return strategy to on

* Add ExitStrategy

* Add TopologyPath

* Add ExitStrategy.ToRelay

* Handle ToRelay

* Refactor

* Refactor

* Refactor

* Handle OnModel with Relay strategy

* parsec -> parseq

* parsec -> parseq

* Add semantics test

* Add topology tests

* Add comments

---------

Co-authored-by: InversionSpaces <InversionSpaces@vivaldi.net>
2023-08-21 14:26:30 +04:00
Dima
019611a89c
feat(compiler): Structural typing for data and abilities [fixes LNG-215] (#843) 2023-08-18 16:15:20 +03:00
InversionSpaces
a5e9354aeb
feat(compiler): Add equality ops [fixes LNG-217] (#820)
* Add eq ops

* Fixed if

* Fix return

* Fix tests

* Add parser tests

* Fix types, add semantics tests

* Add integration tests

* Add integration test

* Remove comment
2023-08-09 13:38:24 +00:00
Dima
ef4b0143ac
fix(compiler): Runtime error on compilation exported functions with top types [fixes LNG-218] (#822) 2023-08-09 16:21:18 +03:00
Dima
4e3e70f4fc
fix(compiler): Nested abilities [fixes LNG-214] (#816) 2023-07-31 14:40:06 +03:00
InversionSpaces
a5b6102422
feat(compiler): Add boolean algebra [fixes LNG-211] (#814) 2023-07-27 14:11:36 +03:00
Dima
63a9f42e86
feat(compiler): Abilities (#731) 2023-07-18 17:18:33 +00:00
InversionSpaces
b8b0fafda0
feat(compiler): Make on propagate errors [fixes LNG-203] (#788)
* Add fail model

* Make `on` propagate error

* Fix unit tests

* Fix TryTag inlining

* Update XorModel.wrap

* Add comments

* Remove wrapWithXor parameter

* Add unit tests

* Add integration tests

* Add comments

* Fix XorBranch topology
2023-07-12 16:18:47 +03:00
InversionSpaces
c1fe24b04d
feat(compiler): Make topology hop with non-FFI snippet [fixes LNG-125] (#764)
* Remove MakeRes.canon

* Replace noop with hop

* Rewrite join

* Remove JoinModel, fix tests

* Share code between tests

* Pass type in RestrictionTag(Model)

* Fix MakeRes.hop

* Fix wrapping

* Rename vars, add comments

* Fix XorBranch topology

* Fix tests
2023-07-06 12:44:37 +03:00
InversionSpaces
8ba7021cd4
refactor(semantics): Refactor semantics to produce concrete tags [fixes LNG-201] (#776)
* Introduce IfTag, TryTag; Remove XorTag

* Add IfTag, TryTag inlining

* Fix test compilation

* Fix test

* Hack to fix topology

* Support try otherwise syntax

* Add comments

* Refactor diff show

* Handle ParTag.Par in single check, add tests
2023-06-29 16:20:47 +00:00
Dima
339d3a8217
refactor: ArrowInliner refactoring (#777) 2023-06-29 11:43:38 +00:00
InversionSpaces
e22fff7c8a
fix(compiler): Fix incorrect service method renaming [fixes LNG-199] (#757)
* Rename only arrows, not service calls

* Add tests

* Fix comment
2023-06-16 15:05:41 +03:00
InversionSpaces
d6e3ec725c
refactor(compiler): Remove ShadowRaw (#742) 2023-06-14 16:41:38 +03:00
InversionSpaces
f1abd587b7
fix(compiler): Fix closure passing [fixes LNG-92] (#747) 2023-06-14 16:09:50 +03:00
InversionSpaces
c5534a964c
fix(compiler): Fix closure call compilation [fixes LNG-193] (#741) 2023-06-13 12:56:17 +03:00
InversionSpaces
e9c004452e
feat(tracing): Introduce function calls tracing [fixes LNG-169] (#732)
* Introduced MetaModel.CallArrowModel

* Fixed ArrowInlinerSpec

* Implemented trace calls injection

* Propagate TracingConfig

* Add tracing flag to js api

* Use detach instead of xor

* Write tests

* ScalarType -> LiteralType

* Add tests

* Fix after rebase

* Fixed tests

* Add tests

* Remove debug prints

* Clean up and add comments

* Fix issues

* Add tracing flag to js api

* Rename liftString -> quote

* Change literal type

* Use CallServiceModel constructor

* Fix js args

* Fixed tests

* Add tracing option to cli
2023-06-12 15:28:27 +02:00
Dima
ddb758cee0
fix(inline): Nullable value in a nested struct [LNG-160] (#724)
Co-authored-by: InversionSpaces <InversionSpaces@vivaldi.net>
2023-06-01 15:54:19 +00:00
Dima
5f00b1ea8d
fix: ParRes with no children converted to Null log (#699) 2023-04-19 12:14:46 +03:00
Dima
8fa979cd33
feat: Return arrows from functions (#693) 2023-04-14 16:28:17 +03:00
Dima
bb24a63abb
fix: Fix type for functor [fixes LNG-119] (#677) 2023-02-28 10:56:49 +03:00