Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gobackend fix #710

Merged
merged 12 commits into from
Sep 29, 2024
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"mode": "auto",
"program": "${workspaceFolder}/cmd/neva",
"cwd": "${workspaceFolder}/examples",
"args": ["run", "filter_list"]
"args": ["run", "struct_selector"]
},
{
"name": "Build",
Expand Down
7 changes: 6 additions & 1 deletion docs/networks.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,12 @@ flow Inc(data int) (res int) {
}
```

Only primitive data-types (`bool`, `int`, `float`, `string`) can be used like this. `struct`, `list`, and `dict` literals are not allowed in the network.
Only primitive data-types (`bool`, `int`, `float`, `string` and `enum`) can be used like this. `struct`, `list`, and `dict` literals are not allowed in the network.

- bool: `true -> ...` or `false -> ...`
- int: `42 -> ...`
- float: `42.0 -> ...`
- enum: `Day::Friday ->`

### Receivers Side

Expand Down
2 changes: 1 addition & 1 deletion e2e/99_bottles_verbose/neva.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
neva: 0.10.0
neva: 0.26.0
2 changes: 1 addition & 1 deletion e2e/99_bottles_with_chain/neva.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
neva: 0.10.0
neva: 0.26.0
2 changes: 1 addition & 1 deletion e2e/add_nums_from_stdin_naive/neva.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
neva: 0.10.0
neva: 0.26.0
2 changes: 1 addition & 1 deletion e2e/add_nums_from_stdin_with_default_any/neva.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
neva: 0.10.0
neva: 0.26.0
2 changes: 1 addition & 1 deletion e2e/add_nums_from_stdin_with_err_handling/neva.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
neva: 0.10.0
neva: 0.26.0
2 changes: 1 addition & 1 deletion e2e/add_nums_from_stdin_with_multuple_senders/neva.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
neva: 0.10.0
neva: 0.26.0
2 changes: 1 addition & 1 deletion e2e/add_nums_from_stdin_with_sub_components/neva.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
neva: 0.10.0
neva: 0.26.0
2 changes: 1 addition & 1 deletion e2e/add_nums_verbose/main/main.neva
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
flow Main(start any) (stop any) {
adder Add<int>
sequencer StreamPort<int>
sequencer ArrPortToStream<int>
println Println<int>

---
Expand Down
2 changes: 1 addition & 1 deletion e2e/add_nums_verbose/neva.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
neva: 0.10.0
neva: 0.26.0
2 changes: 1 addition & 1 deletion e2e/add_nums_with_bridge/neva.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
neva: 0.10.0
neva: 0.26.0
4 changes: 2 additions & 2 deletions e2e/bare_iter_over_list/main/main.neva
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const lst list<int> = [50, 30, 20, 100]

flow Main(start) (stop) {
Println<stream<int>>, Iter<int>, If
Println<stream<int>>, ListToStream<int>, If
---
:start -> ($lst -> iter -> println.last -> if)
:start -> ($lst -> listToStream -> println.last -> if)
if:then -> :stop
}
2 changes: 1 addition & 1 deletion e2e/bare_iter_over_list/neva.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
neva: 0.10.0
neva: 0.26.0
2 changes: 1 addition & 1 deletion e2e/comments/neva.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
neva: 0.10.0
neva: 0.26.0
2 changes: 1 addition & 1 deletion e2e/conn_with_only_port_addr/neva.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
neva: 0.10.0
neva: 0.26.0
2 changes: 1 addition & 1 deletion e2e/const_refs_verbose/neva.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
neva: 0.10.0
neva: 0.26.0
22 changes: 22 additions & 0 deletions e2e/div_test/e2e_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package test

import (
"os/exec"
"testing"

"github.com/stretchr/testify/require"
)

func Test(t *testing.T) {
cmd := exec.Command("neva", "run", "main")

out, err := cmd.CombinedOutput()
require.NoError(t, err)
require.Equal(
t,
"4\n",
string(out),
)

require.Equal(t, 0, cmd.ProcessState.ExitCode())
}
6 changes: 6 additions & 0 deletions e2e/div_test/main/main.neva
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
flow Main(start) (stop) {
Div<int>, Println
---
:start -> [(12 -> div:acc), (3 -> div:el)]
[div:res, div:err] -> println -> :stop
}
1 change: 1 addition & 0 deletions e2e/div_test/neva.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
neva: 0.26.0
2 changes: 1 addition & 1 deletion e2e/do_nothing_verbose/neva.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
neva: 0.10.0
neva: 0.26.0
2 changes: 1 addition & 1 deletion e2e/echo_verbose/neva.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
neva: 0.10.0
neva: 0.26.0
2 changes: 1 addition & 1 deletion e2e/enums_verbose/neva.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
neva: 0.10.0
neva: 0.26.0
2 changes: 1 addition & 1 deletion e2e/float_const_with_int_lit/neva.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
neva: 0.10.0
neva: 0.26.0
4 changes: 2 additions & 2 deletions e2e/for_loop_over_list_verbose/main/main.neva
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const lst list<int> = [50, 30, 20, 100]

flow Main(start) (stop) {
Iter, For{Println}, Wait
ListToStream, ForEach{Println}, Wait
---
:start -> ($lst -> iter -> for -> wait -> :stop)
:start -> ($lst -> listToStream -> forEach -> wait -> :stop)
}
2 changes: 1 addition & 1 deletion e2e/for_loop_over_list_verbose/neva.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
neva: 0.10.0
neva: 0.26.0
10 changes: 5 additions & 5 deletions e2e/for_with_range_and_if/main/main.neva
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ import { lists }
const lst list<bool> = [true, false]

flow Main(start) (stop) {
Iter<bool>, Map<bool, int>{Mapper}, For{Println}, Wait
ListToStream<bool>, ForEach<bool>{PrintAsNum}, Wait
---
:start -> ($lst -> iter -> map -> for -> wait -> :stop)
:start -> ($lst -> listToStream -> forEach -> wait -> :stop)
}

flow Mapper(data bool) (res int) {
Ternary<int>
flow PrintAsNum(data bool) (sig any) {
Ternary, Println
---
:data -> ternary:if
1 -> ternary:then
0 -> ternary:else
ternary -> :res
ternary -> println -> :sig
}
2 changes: 1 addition & 1 deletion e2e/for_with_range_and_if/neva.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
neva: 0.10.0
neva: 0.26.0
2 changes: 1 addition & 1 deletion e2e/hello_world_verbose/neva.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
neva: 0.10.0
neva: 0.26.0
2 changes: 1 addition & 1 deletion e2e/hello_world_with_const_sender/neva.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
neva: 0.10.0
neva: 0.26.0
2 changes: 1 addition & 1 deletion e2e/hello_world_with_implicit_any/neva.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
neva: 0.10.0
neva: 0.26.0
2 changes: 1 addition & 1 deletion e2e/hello_world_with_literal_sender/neva.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
neva: 0.10.0
neva: 0.26.0
2 changes: 1 addition & 1 deletion e2e/hello_world_with_then_connection/neva.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
neva: 0.10.0
neva: 0.26.0
2 changes: 1 addition & 1 deletion e2e/hello_world_with_unnamed_node/neva.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
neva: 0.10.0
neva: 0.26.0
22 changes: 22 additions & 0 deletions e2e/inc_test/e2e_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package test

import (
"os/exec"
"testing"

"github.com/stretchr/testify/require"
)

func Test(t *testing.T) {
cmd := exec.Command("neva", "run", "main")

out, err := cmd.CombinedOutput()
require.NoError(t, err)
require.Equal(
t,
"42\n",
string(out),
)

require.Equal(t, 0, cmd.ProcessState.ExitCode())
}
6 changes: 6 additions & 0 deletions e2e/inc_test/main/main.neva
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
flow Main(start) (stop) {
Inc<int>, Println<int>
---
:start -> (41 -> inc)
inc -> println -> :stop
}
1 change: 1 addition & 0 deletions e2e/inc_test/neva.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
neva: 0.26.0
2 changes: 1 addition & 1 deletion e2e/incompat_comp_type_arg/neva.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
neva: 0.10.0
neva: 0.26.0
8 changes: 4 additions & 4 deletions e2e/incompat_types_with_untyped_port/main/main.neva
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
flow Main(start) (stop) {
Sworktest
StreamPort<int>
ArrPortToStream<int>
Println
---
:start -> [
(1 -> streamPort[0]),
(2 -> streamPort[1])
(1 -> arrPortToStream[0]),
(2 -> arrPortToStream[1])
]
streamPort -> sworktest -> println -> :stop
arrPortToStream -> sworktest -> println -> :stop
}

flow Sworktest(in) (out) {
Expand Down
2 changes: 1 addition & 1 deletion e2e/incompat_types_with_untyped_port/neva.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
neva: 0.10.0
neva: 0.26.0
2 changes: 1 addition & 1 deletion e2e/interface_anonymous/neva.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
neva: 0.10.0
neva: 0.26.0
2 changes: 1 addition & 1 deletion e2e/interface_verbose/neva.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
neva: 0.10.0
neva: 0.26.0
2 changes: 1 addition & 1 deletion e2e/interface_with_imports/neva.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
neva: 0.10.0
neva: 0.26.0
deps:
github.com/nevalang/x:
path: github.com/nevalang/x
Expand Down
2 changes: 1 addition & 1 deletion e2e/list_with_neg_nums/neva.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
neva: 0.10.0
neva: 0.26.0
2 changes: 1 addition & 1 deletion e2e/local_imports/neva.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
neva: 0.10.0
neva: 0.26.0
4 changes: 2 additions & 2 deletions e2e/map_list_verbose/main/main.neva
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ flow Main(start) (stop) {
Map<int, int>{Decr<int>}
List
Println
Iter<int>
ListToStream<int>
---
:start -> ($lst -> iter -> map -> list -> println -> :stop)
:start -> ($lst -> listToStream -> map -> list -> println -> :stop)
}
2 changes: 1 addition & 1 deletion e2e/map_list_verbose/neva.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
neva: 0.10.0
neva: 0.26.0
16 changes: 8 additions & 8 deletions e2e/multiply_numbers/main/main.neva
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
const l list<int> = [1, 2, 3]

flow Main(start) (stop) {
Println
mul ReducePort { Mul<int> }
Reduce<int, int>{Mul<int>}
ListToStream<int>
---
:start -> [
(1 -> mul[0]),
(2 -> mul[1]),
(3 -> mul[2])
]
mul -> println -> :stop
}
:start -> ($l -> listToStream -> reduce:data)
1 -> reduce:init
reduce -> println -> :stop
}
2 changes: 1 addition & 1 deletion e2e/multiply_numbers/neva.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
neva: 0.10.0
neva: 0.26.0
2 changes: 1 addition & 1 deletion e2e/order_dependend_with_arr_inport/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func Test(t *testing.T) {
require.NoError(t, err)
require.Equal(
t,
"-4\n",
"-6\n",
string(out),
)

Expand Down
15 changes: 7 additions & 8 deletions e2e/order_dependend_with_arr_inport/main/main.neva
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
const l list<int> = [1, 2, 3]

flow Main(start) (stop) {
Println<int>
sub ReducePort<int> { Sub<int> }
Reduce<int, int>{Sub<int>}
ListToStream<int>
---
:start -> [
(1 -> sub:port[0]),
(2 -> sub:port[1]),
(3 -> sub:port[2])
]
sub:res -> println:data
println:sig -> :stop
:start -> ($l -> listToStream -> reduce:data)
0 -> reduce:init
reduce -> println -> :stop
}
2 changes: 1 addition & 1 deletion e2e/order_dependend_with_arr_inport/neva.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
neva: 0.10.0
neva: 0.26.0
Loading
Loading