From bff934f184660a13f031bdc860f3baded119ce68 Mon Sep 17 00:00:00 2001 From: Emil Valeev Date: Wed, 27 Nov 2024 02:38:08 +0500 Subject: [PATCH 1/6] wip(tutorial:switch) --- docs/book/networks.md | 4 +- docs/tutorial.md | 94 +++++++++++++++++++++++++++++++------------ 2 files changed, 71 insertions(+), 27 deletions(-) diff --git a/docs/book/networks.md b/docs/book/networks.md index 3f6a18fe..98a1bcf6 100644 --- a/docs/book/networks.md +++ b/docs/book/networks.md @@ -575,8 +575,8 @@ sender -> switch { // nested sender -> switch { true -> switch { - 1 -> receiver1 - 2 -> receiver2 + (1 == 1) -> receiver1 + (2 > 3) -> receiver2 _ -> receiver3 } false -> receiver4 diff --git a/docs/tutorial.md b/docs/tutorial.md index c41c7119..fd7c7d5a 100644 --- a/docs/tutorial.md +++ b/docs/tutorial.md @@ -13,36 +13,14 @@ Welcome to a tour of the Nevalang programming language. This tutorial will intro - [Constants](#constants) - [Modules and Packages](#modules-and-packages) - [Imports and Visibility](#imports-and-visibility) - 3. [Dataflow Basics](#dataflow) - [Chained Connections](#chained-connections) - [Multiple Ports](#multiple-ports) - [Fan-In/Fan-Out](#fan-infan-out) - [Binary Operators](#binary-operators) - - - - - - - - - - - - - - - - - - - - - - - - + - [Ternary Operator](#ternary-operator) + - [Switch Expression](#switch-expression) + - [Deferred Connections](#deferred-connections) ## Welcome @@ -718,3 +696,69 @@ def Main(start any) (stop any) { ``` This example calculates a triangle's area (base=20, height=10), checks if it's larger than 50, and prints either "Big" or "Small" accordingly. While contrived, it demonstrates how the ternary operator can be used in more complex scenarios. + +### Switch Expression + +So far we've learned how to _select_ sources based on conditions, but the message's _route_ was always the same. For example, in `utils.FormatBool` we selected either `'true'` or `'false'` but the destination was always `:res` - `(:data ? 'true' : 'false') -> :res`. To write real programs we need to be able to select both sources and destinations. In other words, we need "routers" in addition to "selectors", and `switch` is one of them. It has the following syntax: + +```neva +condition_sender -> switch { + case_sender_1 -> case_receiver_1 + case_sender_2 -> case_receiver_2 + ... + _ -> default_receiver +} +``` + +Switch consists of a condition sender and pairs of case senders/receivers, including a required default case with `_`. It waits for all senders, compares the condition message with case messages for equality, and executes the first matching branch. Once triggered, other branches won't fire until the next message arrives. Let's add another component to `src/utils/utils.neva` to see `switch` in action: + +```neva +pub def HttpStatus(code int) ( + continue any, + ok any, + multiple_choices any, + bad_request any, + internal_err any, + unknown any +) { + :code -> switch { + 100 -> :continue + 200 -> :ok + 300 -> :multiple_choices + 400 -> :bad_request + 500 -> :internal_err + _ -> :unknown + } +} +``` + +This component receives an integer `code` and based on its value sends to one of its 6 outports. + + + + + +#### If/Else + +So far switch branches were chosen by comparing messages, but sometimes we just need to branch on a boolean value. Since Nevalang has no if-else construct, this pattern is implemented using `switch`: + +```neva +pub def ClassifyInt(data int) (neg any, pos any) { + :start -> (data >= 0) -> switch { + true -> :pos + _ -> :neg + } +} +``` + +Things to notice: + +1. We send `bool` messages to both outports `neg` and `pos`, which works since they're typed as `any` +2. We use `_` as default case rather than `(:data < 0)` since switch requires a default and negative is the only other option +3. This works naturally with switch's behavior - we compare the `bool` condition with `true`, and `_` handles `false` + +#### Switch True + +... + + From a5f0aca19e37f8cbf2a4bace5eeb30839dbff9de Mon Sep 17 00:00:00 2001 From: Emil Valeev Date: Wed, 27 Nov 2024 23:01:48 +0500 Subject: [PATCH 2/6] feat(std): strings upper, lower; fmt print; fix(analyzer): compiler errors --- .vscode/launch.json | 4 +-- internal/compiler/analyzer/interface.go | 1 + internal/compiler/analyzer/main_component.go | 2 +- internal/compiler/analyzer/network.go | 2 +- internal/runtime/funcs/http.go | 4 +-- internal/runtime/funcs/print.go | 35 +++++++++++++++++++ internal/runtime/funcs/registry.go | 9 +++-- internal/runtime/funcs/string_split.go | 4 +-- internal/runtime/funcs/strings_to_lower.go | 36 ++++++++++++++++++++ internal/runtime/funcs/strings_to_upper.go | 36 ++++++++++++++++++++ std/fmt/fmt.neva | 3 ++ std/http/http.neva | 6 ++-- std/strings/strings.neva | 10 ++++-- 13 files changed, 136 insertions(+), 16 deletions(-) create mode 100644 internal/runtime/funcs/print.go create mode 100644 internal/runtime/funcs/strings_to_lower.go create mode 100644 internal/runtime/funcs/strings_to_upper.go diff --git a/.vscode/launch.json b/.vscode/launch.json index ae0613fe..5d6afc9d 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -7,8 +7,8 @@ "request": "launch", "mode": "auto", "program": "${workspaceFolder}/cmd/neva", - "cwd": "${workspaceFolder}/e2e/add_numbers", - "args": ["run", "--trace", "main"] + "cwd": "${workspaceFolder}/examples", + "args": ["run", "--trace", "switch"] }, { "name": "DEBUG CODEGEN", diff --git a/internal/compiler/analyzer/interface.go b/internal/compiler/analyzer/interface.go index b0b9fd67..b7b5196e 100644 --- a/internal/compiler/analyzer/interface.go +++ b/internal/compiler/analyzer/interface.go @@ -48,6 +48,7 @@ func (a Analyzer) analyzeInterface( return src.Interface{ TypeParams: typeParams, IO: resolvedIO, + Meta: iface.Meta, }, nil } diff --git a/internal/compiler/analyzer/main_component.go b/internal/compiler/analyzer/main_component.go index e4f045c0..fe12c3f5 100644 --- a/internal/compiler/analyzer/main_component.go +++ b/internal/compiler/analyzer/main_component.go @@ -89,7 +89,7 @@ func (Analyzer) analyzeMainFlowNodes( node.EntityRef, err, ), - Location: &loc, + Location: scope.Location(), Meta: &node.EntityRef.Meta, } } diff --git a/internal/compiler/analyzer/network.go b/internal/compiler/analyzer/network.go index 3655baa0..626277b2 100644 --- a/internal/compiler/analyzer/network.go +++ b/internal/compiler/analyzer/network.go @@ -979,7 +979,7 @@ func (a Analyzer) analyzeNetPortsUsage( outportsUsage, ok := nodesUsage["out"] if !ok { return &compiler.Error{ - Message: "Unused outports", + Message: "Component must use its outports", Location: scope.Location(), Meta: &compInterface.Meta, } diff --git a/internal/runtime/funcs/http.go b/internal/runtime/funcs/http.go index e94b165a..4de1b509 100644 --- a/internal/runtime/funcs/http.go +++ b/internal/runtime/funcs/http.go @@ -16,7 +16,7 @@ func (httpGet) Create(funcIO runtime.IO, _ runtime.Msg) (func(ctx context.Contex return nil, err } - respOut, err := funcIO.Out.Single("resp") + resOut, err := funcIO.Out.Single("res") if err != nil { return nil, err } @@ -49,7 +49,7 @@ func (httpGet) Create(funcIO runtime.IO, _ runtime.Msg) (func(ctx context.Contex continue } - if !respOut.Send( + if !resOut.Send( ctx, respMsg(resp.StatusCode, body), ) { diff --git a/internal/runtime/funcs/print.go b/internal/runtime/funcs/print.go new file mode 100644 index 00000000..5167cbc3 --- /dev/null +++ b/internal/runtime/funcs/print.go @@ -0,0 +1,35 @@ +package funcs + +import ( + "context" + "fmt" + + "github.com/nevalang/neva/internal/runtime" +) + +type print struct{} + +func (p print) Create(io runtime.IO, _ runtime.Msg) (func(ctx context.Context), error) { + dataIn, err := io.In.Single("data") + if err != nil { + return nil, err + } + + sigOut, err := io.Out.Single("sig") + if err != nil { + return nil, err + } + + return func(ctx context.Context) { + for { + data, ok := dataIn.Receive(ctx) + if !ok { + return + } + fmt.Print(data) + if !sigOut.Send(ctx, data) { + return + } + } + }, nil +} diff --git a/internal/runtime/funcs/registry.go b/internal/runtime/funcs/registry.go index bb528503..c8a802fd 100644 --- a/internal/runtime/funcs/registry.go +++ b/internal/runtime/funcs/registry.go @@ -80,14 +80,17 @@ func NewRegistry() map[string]runtime.FuncCreator { "time_delay": timeDelay{}, "time_after": timeAfter{}, - "string_at": stringAt{}, - "join": stringJoin{}, - "split": stringSplit{}, + "string_at": stringAt{}, + "strings_join": stringJoin{}, + "strings_split": stringsSplit{}, + "strings_to_upper": stringsToUpper{}, + "strings_to_lower": stringsToLower{}, "scanln": scanln{}, "args": args{}, "println": println{}, "printf": printf{}, + "print": print{}, "read_all": fileReadAll{}, "write_all": writeAll{}, diff --git a/internal/runtime/funcs/string_split.go b/internal/runtime/funcs/string_split.go index 0ce839e9..67aafc96 100644 --- a/internal/runtime/funcs/string_split.go +++ b/internal/runtime/funcs/string_split.go @@ -7,9 +7,9 @@ import ( "github.com/nevalang/neva/internal/runtime" ) -type stringSplit struct{} +type stringsSplit struct{} -func (p stringSplit) Create(io runtime.IO, _ runtime.Msg) (func(ctx context.Context), error) { +func (p stringsSplit) Create(io runtime.IO, _ runtime.Msg) (func(ctx context.Context), error) { dataIn, err := io.In.Single("data") if err != nil { return nil, err diff --git a/internal/runtime/funcs/strings_to_lower.go b/internal/runtime/funcs/strings_to_lower.go new file mode 100644 index 00000000..a184a8d6 --- /dev/null +++ b/internal/runtime/funcs/strings_to_lower.go @@ -0,0 +1,36 @@ +package funcs + +import ( + "context" + "strings" + + "github.com/nevalang/neva/internal/runtime" +) + +type stringsToLower struct{} + +func (p stringsToLower) Create(io runtime.IO, _ runtime.Msg) (func(ctx context.Context), error) { + dataIn, err := io.In.Single("data") + if err != nil { + return nil, err + } + + resOut, err := io.Out.Single("res") + if err != nil { + return nil, err + } + + return func(ctx context.Context) { + for { + data, ok := dataIn.Receive(ctx) + if !ok { + return + } + + result := strings.ToLower(data.Str()) + if !resOut.Send(ctx, runtime.NewStringMsg(result)) { + return + } + } + }, nil +} diff --git a/internal/runtime/funcs/strings_to_upper.go b/internal/runtime/funcs/strings_to_upper.go new file mode 100644 index 00000000..5ddc31b2 --- /dev/null +++ b/internal/runtime/funcs/strings_to_upper.go @@ -0,0 +1,36 @@ +package funcs + +import ( + "context" + "strings" + + "github.com/nevalang/neva/internal/runtime" +) + +type stringsToUpper struct{} + +func (p stringsToUpper) Create(io runtime.IO, _ runtime.Msg) (func(ctx context.Context), error) { + dataIn, err := io.In.Single("data") + if err != nil { + return nil, err + } + + resOut, err := io.Out.Single("res") + if err != nil { + return nil, err + } + + return func(ctx context.Context) { + for { + data, ok := dataIn.Receive(ctx) + if !ok { + return + } + + result := strings.ToUpper(data.Str()) + if !resOut.Send(ctx, runtime.NewStringMsg(result)) { + return + } + } + }, nil +} diff --git a/std/fmt/fmt.neva b/std/fmt/fmt.neva index 41615000..e9588bb6 100644 --- a/std/fmt/fmt.neva +++ b/std/fmt/fmt.neva @@ -3,6 +3,9 @@ #extern(println) pub def Println(data T) (sig struct{}) +#extern(print) +pub def Print(data T) (sig struct{}) + // Printf replaces `$` with the corresponding argument // and prints to the standard output. #extern(printf) diff --git a/std/http/http.neva b/std/http/http.neva index d9a762c0..4d5d2db3 100644 --- a/std/http/http.neva +++ b/std/http/http.neva @@ -1,7 +1,7 @@ pub type Response struct { - statusCode int - body string + statusCode int + body string } #extern(http_get) -pub def Get(url string) (resp Response, err error) +pub def Get(url string) (res Response, err error) diff --git a/std/strings/strings.neva b/std/strings/strings.neva index f165a4be..a8b2532a 100644 --- a/std/strings/strings.neva +++ b/std/strings/strings.neva @@ -1,5 +1,11 @@ -#extern(join) +#extern(strings_join) pub def Join(data list) (res string) -#extern(split) +#extern(strings_split) pub def Split(data string, delim string) (res list) + +#extern(strings_to_upper) +pub def ToUpper(data string) (res string) + +#extern(strings_to_lower) +pub def ToLower(data string) (res string) From 408771787807fe176d3d6a16c62420a33aec6ff1 Mon Sep 17 00:00:00 2001 From: Emil Valeev Date: Wed, 27 Nov 2024 23:45:53 +0500 Subject: [PATCH 3/6] feat(docs:tutorial): more sections about switch --- docs/book/networks.md | 4 +- docs/tutorial.md | 120 +++++++++++++++------ examples/advanced_error_handling/main.neva | 2 +- examples/http_get/main.neva | 2 +- 4 files changed, 95 insertions(+), 33 deletions(-) diff --git a/docs/book/networks.md b/docs/book/networks.md index 98a1bcf6..91f0c337 100644 --- a/docs/book/networks.md +++ b/docs/book/networks.md @@ -603,7 +603,9 @@ sender -> switch { } ``` -If the `sender` message is equal to _either_ `a` or `b`, it will be sent to _both_ `receiver1` and `receiver2`. You can also have multiple senders and one receiver, or one sender and multiple receivers. +Case senders `a` and `b` are concurrent to each other, the one that will send faster, will be used by switch as a case value. This might be counter intuitive, because one might expect that this works like in controlflow languages where multple cases on a same line means "either". + +Multiple receivers on the other hand work as expected. I.e. if `sender` message is equal to `c` in this example, then it will be sent to both `receiver3` and `receiver5`. ## Fan-in and Fan-out diff --git a/docs/tutorial.md b/docs/tutorial.md index fd7c7d5a..a4a9cc71 100644 --- a/docs/tutorial.md +++ b/docs/tutorial.md @@ -20,7 +20,7 @@ Welcome to a tour of the Nevalang programming language. This tutorial will intro - [Binary Operators](#binary-operators) - [Ternary Operator](#ternary-operator) - [Switch Expression](#switch-expression) - - [Deferred Connections](#deferred-connections) + ## Welcome @@ -699,7 +699,13 @@ This example calculates a triangle's area (base=20, height=10), checks if it's l ### Switch Expression -So far we've learned how to _select_ sources based on conditions, but the message's _route_ was always the same. For example, in `utils.FormatBool` we selected either `'true'` or `'false'` but the destination was always `:res` - `(:data ? 'true' : 'false') -> :res`. To write real programs we need to be able to select both sources and destinations. In other words, we need "routers" in addition to "selectors", and `switch` is one of them. It has the following syntax: +So far we've learned how to _select_ sources based on conditions, but the message's _route_ was always the same. For example, in `utils.FormatBool` we selected either `'true'` or `'false'` but the destination was always `:res`: + +```neva +(:data ? 'true' : 'false') -> :res +``` + +To write real programs we need to be able to configure both sources and destinations. In other words, we need "routers" in addition to "selectors", and `switch` is one of them. It has the following syntax: ```neva condition_sender -> switch { @@ -710,41 +716,82 @@ condition_sender -> switch { } ``` -Switch consists of a condition sender and pairs of case senders/receivers, including a required default case with `_`. It waits for all senders, compares the condition message with case messages for equality, and executes the first matching branch. Once triggered, other branches won't fire until the next message arrives. Let's add another component to `src/utils/utils.neva` to see `switch` in action: +Switch consists of a "condition" sender and "case" sender/receiver pairs, including a required default case with `_`. It compares the condition message with case messages for equality and executes the first matching branch. Once triggered, other branches won't fire until the next iteration. + +Let's see switch in action. We're going write a program that reads name from standard output and if name is 'Alice' makes it upper case and prints, if its 'Bob' it makes it lowercase and prints (sorry, Bob), otherwise it panics because it only knows these two names: + +```neva +// src/main.neva + +import { + fmt + strings +} + +def Main(start any) (stop any) { + print fmt.Print + scanln fmt.Scanln + upper strings.ToUpper + lower strings.ToLower + println fmt.Println + panic Panic + --- + :start -> 'Enter the name: ' -> print -> scanln -> switch { + 'Alice' -> upper + 'Bob' -> lower + _ -> panic + } + [upper, lower] -> println -> :stop +} +``` + +We used several new things here. First, the `strings` package from the standard library contains components for string manipulation. In this example we use `strings.ToUpper` and `strings.ToLower` to convert text case. + +The `fmt` package is used again - `fmt.Print` works like `Println` but without adding `\n` at the end, and `fmt.Scanln` waits for keyboard input followed by Enter. + +Finally, there's the builtin `Panic` component. It immediately terminates the program with a non-zero status code when its node receives a message. + +The program prompts for a name, converts it to uppercase for "Alice" or lowercase for "Bob" (panicking for any other input), then prints the result. + +#### Multiple Destinations + +Let's modify our program. For "Alice", we'll uppercase and lowercase simultaneously, concatenate the results and print. Any other name terminates with an error (sorry Bob!). ```neva -pub def HttpStatus(code int) ( - continue any, - ok any, - multiple_choices any, - bad_request any, - internal_err any, - unknown any -) { - :code -> switch { - 100 -> :continue - 200 -> :ok - 300 -> :multiple_choices - 400 -> :bad_request - 500 -> :internal_err - _ -> :unknown +import { + fmt + strings +} + +def Main(start any) (stop any) { + print fmt.Print + scanln fmt.Scanln + upper strings.ToUpper + lower strings.ToLower + println fmt.Println + panic Panic + --- + :start -> 'Enter the name: ' -> print -> scanln -> switch { + 'Alice' -> [upper, lower] + _ -> panic } + (upper + lower) -> println -> :stop } ``` -This component receives an integer `code` and based on its value sends to one of its 6 outports. +Things to notice: - - - +- Fan-out to both `upper` and `lower` nodes for the 'Alice' branch +- Binary expression `(upper + lower)` connects to `println -> :stop` - inside switch we refer to their inports, inside binary expression to outports +- **Implicit parallelism utilized** - `upper` and `lower` will work in parallel, not sequentially #### If/Else -So far switch branches were chosen by comparing messages, but sometimes we just need to branch on a boolean value. Since Nevalang has no if-else construct, this pattern is implemented using `switch`: +While switch can route messages by comparing values to multiple cases, it also serves as Nevalang's if-else when working with boolean conditions. Rather than having a separate if-else construct, we use switch with a boolean condition and two branches - one for true and one for false: ```neva pub def ClassifyInt(data int) (neg any, pos any) { - :start -> (data >= 0) -> switch { + :start -> (:data >= 0) -> switch { true -> :pos _ -> :neg } @@ -753,12 +800,25 @@ pub def ClassifyInt(data int) (neg any, pos any) { Things to notice: -1. We send `bool` messages to both outports `neg` and `pos`, which works since they're typed as `any` -2. We use `_` as default case rather than `(:data < 0)` since switch requires a default and negative is the only other option -3. This works naturally with switch's behavior - we compare the `bool` condition with `true`, and `_` handles `false` +1. Both outports accept `bool` messages since they're typed as `any` +2. We use `_` as default case since negative is the only other option +3. The `_` case naturally handles `false` values + + -#### Switch True +#### Multiple Sources + +One might ask, why didn't we cover multiple case senders if we covered multiple receivers? When using switch with multiple case receivers, it works differently than in control flow languages. For example: + +```neva +switch { + ['Alice', 'Bob'] -> upper + _ -> lower +} +``` -... +Is **not** "if either Alice or Bob then do uppercase". It's a fan-in, meaning `Alice` and `Bob` are concurrent. Switch will select the first value sent as a case, which is random since both are message literals. - +> There's an [issue](https://github.com/nevalang/neva/issues/788). These semantics might change in the future. diff --git a/examples/advanced_error_handling/main.neva b/examples/advanced_error_handling/main.neva index 5d773779..7243900f 100644 --- a/examples/advanced_error_handling/main.neva +++ b/examples/advanced_error_handling/main.neva @@ -12,6 +12,6 @@ def App(sig) (data string, err error) { http.Get? // '?' implicitly sends `:err` downstream --- :sig -> 'definitely not a valid URL' -> get - get:resp -> .body -> :data + get:res -> .body -> :data // no need for explicit error handling thanks to `?` } diff --git a/examples/http_get/main.neva b/examples/http_get/main.neva index 874be729..5346102a 100644 --- a/examples/http_get/main.neva +++ b/examples/http_get/main.neva @@ -4,6 +4,6 @@ def Main(start any) (stop any) { http.Get, fmt.Println, Panic --- :start -> 'http://www.example.com' -> get - get:resp -> .body -> println -> :stop + get:res -> .body -> println -> :stop get:err -> panic } \ No newline at end of file From ded66199e2eb91207a26e46d752cda15a277077a Mon Sep 17 00:00:00 2001 From: Emil Valeev Date: Thu, 28 Nov 2024 21:57:06 +0500 Subject: [PATCH 4/6] feat(docs:tutorial): add section about switch --- docs/tutorial.md | 111 ++++++++++++++++++++++++++++++++++++++++++++--- std/io/io.neva | 1 - 2 files changed, 104 insertions(+), 8 deletions(-) diff --git a/docs/tutorial.md b/docs/tutorial.md index a4a9cc71..8d377a30 100644 --- a/docs/tutorial.md +++ b/docs/tutorial.md @@ -19,8 +19,7 @@ Welcome to a tour of the Nevalang programming language. This tutorial will intro - [Fan-In/Fan-Out](#fan-infan-out) - [Binary Operators](#binary-operators) - [Ternary Operator](#ternary-operator) - - [Switch Expression](#switch-expression) - + - [Switch](#switch) ## Welcome @@ -697,7 +696,7 @@ def Main(start any) (stop any) { This example calculates a triangle's area (base=20, height=10), checks if it's larger than 50, and prints either "Big" or "Small" accordingly. While contrived, it demonstrates how the ternary operator can be used in more complex scenarios. -### Switch Expression +### Switch So far we've learned how to _select_ sources based on conditions, but the message's _route_ was always the same. For example, in `utils.FormatBool` we selected either `'true'` or `'false'` but the destination was always `:res`: @@ -787,7 +786,7 @@ Things to notice: #### If/Else -While switch can route messages by comparing values to multiple cases, it also serves as Nevalang's if-else when working with boolean conditions. Rather than having a separate if-else construct, we use switch with a boolean condition and two branches - one for true and one for false: +While switch can route messages by comparing values to multiple cases, it also serves as Nevalang's if-else when working with boolean conditions. Rather than having a separate if-else construct, we use switch with a boolean condition and two branches - one for true and one for false. Let's add one more component to `src/utils/utils.neva`: ```neva pub def ClassifyInt(data int) (neg any, pos any) { @@ -804,9 +803,107 @@ Things to notice: 2. We use `_` as default case since negative is the only other option 3. The `_` case naturally handles `false` values - +```neva +import { + fmt + @:utils +} + +def Main(start any) (stop any) { + classify utils.ClassifyInt + println1 fmt.Println + println2 fmt.Println + --- + :start -> -42 -> classify + classify:pos -> 'positive :)' -> println1 + classify:neg -> 'negative :(' -> println2 + [println1, println2] -> :stop +} +``` + +Outputs: + +``` +negative :( +``` + +#### Switch True + +So far we've explored message routing through comparison with set of values and boolean branching with if-else pattern. However, sometimes we need to chain multiple conditional branches where each condition is independent and not just comparing against an input value. This pattern, known as "switch-true", allows us to check multiple conditions in sequence and route messages accordingly. + +Let's add one more component to `src/utils/utils.neva` and call it `CommentOnUser`. If user's name "Bob" it will comment on that, because that's the most important thing, otherwise if user's age is under 18, it will comment about that. Otherwise, if there's nothing to comment, it will just panic. + +```neva +// ...existing code... + +pub def CommentOnUser(name string, age int) (sig any) { + println1 fmt.Println + println2 fmt.Println + panic Panic + --- + true -> switch { + (:name == 'Bob') -> 'Beauteful name!' -> println1 + (:age < 18) -> 'Young fellow!' -> println2 + _ -> panic + } +} +``` + +Here's how it can be used in `src/main.neva` + +```neva +import { + fmt + @:utils +} + +def Main(start any) (stop any) { + comment utils.CommentOnUser + --- + :start -> [ + 'Bob' -> comment:name, + 17 -> comment:age + ] + comment -> :stop +} +``` + +Output: + +``` +Young fellow! +``` + +Note that `utils.CommentOnUser` ignored age of the user, even though it was 33. This is because how switch works - it doesn't trigger several branches in a single iteration, and once it selects branch to execute, it will ignore other branches, until next iteration will start. We can test it by replacing `Bob` with e.g. `Alice` - our switch isn't interested in Alice, but age is still 33 and it will comment on that instead. + +```neva +:start -> [ + 'Alice' -> comment:name, + 17 -> comment:age +] +``` + +Output: + +``` +Young fellow! +``` + +By the way, there's another way to solve this problem. We can use if-else pattern and nest switches one inside another like this: + +```neva +:age < 18 -> switch { + true -> 'Young fellow!' -> println1 + _ -> (:name == 'Bob') -> switch { + true -> 'Beauteful name!' -> println2 + _ -> panic + } +} +``` + +You should never do that if it's possible to follow "switch-true" pattern, because it's much easier to read and doesn't envolve two switch nodes. #### Multiple Sources @@ -821,4 +918,4 @@ switch { Is **not** "if either Alice or Bob then do uppercase". It's a fan-in, meaning `Alice` and `Bob` are concurrent. Switch will select the first value sent as a case, which is random since both are message literals. -> There's an [issue](https://github.com/nevalang/neva/issues/788). These semantics might change in the future. +> These semantics might change in the future. There's an [issue](https://github.com/nevalang/neva/issues/788) about that. diff --git a/std/io/io.neva b/std/io/io.neva index 78ce7344..cbba8a34 100644 --- a/std/io/io.neva +++ b/std/io/io.neva @@ -12,4 +12,3 @@ pub def ReadAll(filename string) (res string, err error) #extern(write_all) pub def WriteAll(filename string, data string) (sig any, err error) - From 4147ad8f99cfe09d96f6b51dd0c2898b0ee5460b Mon Sep 17 00:00:00 2001 From: Emil Valeev Date: Thu, 28 Nov 2024 22:02:35 +0500 Subject: [PATCH 5/6] feat(version): bump to 0.28 --- pkg/version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/version.go b/pkg/version.go index f4a87719..f5f7536f 100644 --- a/pkg/version.go +++ b/pkg/version.go @@ -2,4 +2,4 @@ package pkg // Version is the current version of the language and stdlib. // Don't forget to update it before release new tag. -var Version = "0.27.1" //nolint:gochecknoglobals +var Version = "0.28.0" //nolint:gochecknoglobals From aeb7312da3039f3ec2892f9820c82ce38fcd6108 Mon Sep 17 00:00:00 2001 From: Emil Valeev Date: Thu, 28 Nov 2024 22:16:41 +0500 Subject: [PATCH 6/6] fix(e2e): update arr slot holes assertions --- docs/book/program_structure.md | 6 +++--- docs/tutorial.md | 4 ++-- e2e/99_bottles_verbose/neva.yml | 2 +- e2e/add_nums_from_stdin_naive/neva.yml | 2 +- e2e/add_nums_from_stdin_with_default_any/neva.yml | 2 +- e2e/add_nums_from_stdin_with_err_handling/neva.yml | 2 +- e2e/add_nums_from_stdin_with_multuple_senders/neva.yml | 2 +- e2e/add_nums_from_stdin_with_sub_components/neva.yml | 2 +- e2e/add_nums_verbose/neva.yml | 2 +- e2e/array_inport_holes/e2e_test.go | 2 +- e2e/array_inport_holes/neva.yml | 2 +- e2e/array_outport_holes/e2e_test.go | 2 +- e2e/array_outport_holes/neva.yml | 2 +- e2e/binary_operators/arithmetic/add/neva.yml | 2 +- e2e/binary_operators/arithmetic/divide/neva.yml | 2 +- e2e/binary_operators/arithmetic/modulo/neva.yml | 2 +- e2e/binary_operators/arithmetic/multiply/neva.yml | 2 +- e2e/binary_operators/arithmetic/power/neva.yml | 2 +- e2e/binary_operators/arithmetic/subtract/neva.yml | 2 +- e2e/binary_operators/bitwise/and/neva.yml | 2 +- e2e/binary_operators/bitwise/left_shift/neva.yml | 2 +- e2e/binary_operators/bitwise/or/neva.yml | 2 +- e2e/binary_operators/bitwise/right_shift/neva.yml | 2 +- e2e/binary_operators/bitwise/xor/neva.yml | 2 +- e2e/binary_operators/comparison/equal/neva.yml | 2 +- e2e/binary_operators/comparison/greater/neva.yml | 2 +- e2e/binary_operators/comparison/greater_equal/neva.yml | 2 +- e2e/binary_operators/comparison/less/neva.yml | 2 +- e2e/binary_operators/comparison/less_equal/neva.yml | 2 +- e2e/binary_operators/comparison/not_equal/neva.yml | 2 +- e2e/binary_operators/logical/and/neva.yml | 2 +- e2e/binary_operators/logical/or/neva.yml | 2 +- e2e/cli_new/neva.yml | 2 +- e2e/comments/neva.yml | 2 +- e2e/compiler_error_unused_outport/neva.yml | 2 +- e2e/const_refs_verbose/neva.yml | 2 +- e2e/div_test/neva.yml | 2 +- e2e/do_nothing_verbose/neva.yml | 2 +- e2e/duplicate_receiver/neva.yml | 2 +- e2e/duplicate_sender/neva.yml | 2 +- e2e/echo_verbose/neva.yml | 2 +- e2e/enums_verbose/neva.yml | 2 +- e2e/float_const_with_int_lit/neva.yml | 2 +- e2e/for_loop_over_list_verbose/neva.yml | 2 +- e2e/for_with_range_and_if/neva.yml | 2 +- e2e/hello_world_verbose/neva.yml | 2 +- e2e/hello_world_with_const_sender/neva.yml | 2 +- e2e/hello_world_with_implicit_any/neva.yml | 2 +- e2e/hello_world_with_literal_sender/neva.yml | 2 +- e2e/hello_world_with_then_connection/neva.yml | 2 +- e2e/hello_world_with_unnamed_node/neva.yml | 2 +- e2e/inc_test/neva.yml | 2 +- e2e/incompat_comp_type_arg/neva.yml | 2 +- e2e/incompat_types_with_untyped_port/neva.yml | 2 +- e2e/interface_anonymous/neva.yml | 2 +- e2e/interface_verbose/neva.yml | 2 +- e2e/interface_with_imports/neva.yml | 2 +- e2e/list_with_neg_nums/neva.yml | 2 +- e2e/local_imports/neva.yml | 2 +- e2e/map_list_verbose/neva.yml | 2 +- e2e/multiply_numbers/neva.yml | 2 +- e2e/non_unique_fan_in/neva.yml | 2 +- e2e/non_unique_fan_out/neva.yml | 2 +- e2e/order_dependend_with_arr_inport/neva.yml | 2 +- e2e/print_float/neva.yml | 2 +- e2e/regex_submatch_verbose/neva.yml | 2 +- e2e/run_cli_not_from_module_root/neva.yml | 2 +- e2e/simple_fan_out/neva.yml | 2 +- e2e/slow_iteration_with_for/neva.yml | 2 +- e2e/slow_iteration_with_map/neva.yml | 2 +- e2e/struct_builder_verbose/neva.yml | 2 +- e2e/struct_builder_with_sugar/neva.yml | 2 +- e2e/struct_selector_on_port_addr/neva.yml | 2 +- e2e/struct_selector_verbose/neva.yml | 2 +- e2e/struct_selector_with_more_sugar/neva.yml | 2 +- e2e/struct_selector_with_sugar/neva.yml | 2 +- e2e/type_expr_with_imported_type_arg/neva.yml | 2 +- examples/neva.yml | 2 +- internal/builder/tests/intergration_test.go | 4 ++-- internal/builder/tests/testmod/neva.yml | 2 +- std/neva.yml | 2 +- 81 files changed, 85 insertions(+), 85 deletions(-) diff --git a/docs/book/program_structure.md b/docs/book/program_structure.md index ecfe6e17..d9e6820f 100644 --- a/docs/book/program_structure.md +++ b/docs/book/program_structure.md @@ -36,10 +36,10 @@ Module is usually a git-repo but not necessary. Module that isn't published in g ### Manifest File -The manifest defines the module's minimum supported language version and dependencies. Here's an example manifest with a dependency on the Nevalang compiler version `0.27.1` and a third-party module: +The manifest defines the module's minimum supported language version and dependencies. Here's an example manifest with a dependency on the Nevalang compiler version `0.28.0` and a third-party module: ```yaml -neva: 0.27.1 +neva: 0.28.0 deps: github.com/nevalang/x: path: github.com/nevalang/x @@ -51,7 +51,7 @@ The `deps` field is a map where each dependency has an alias. When adding depend > WIP: CLI tool planned for CI/CD to verify module's backward compatibility ```yaml -neva: 0.27.1 +neva: 0.28.0 deps: github.com/nevalang/x@0-0-12: path: github.com/nevalang/x diff --git a/docs/tutorial.md b/docs/tutorial.md index 8d377a30..6c839024 100644 --- a/docs/tutorial.md +++ b/docs/tutorial.md @@ -77,7 +77,7 @@ After installation is finished, you should be able to run the `neva` CLI from yo neva version ``` -It should emit something like `0.27.1` +It should emit something like `0.28.0` ### Hello, World! @@ -254,7 +254,7 @@ This structure introduces two fundamental concepts in Nevalang: modules and pack A module is a set of packages with a manifest file (`neva.yaml`). When we created our project with `neva new`, it generated a basic module with the following manifest file: ```yaml -neva: 0.27.1 +neva: 0.28.0 ``` This defines the Nevalang version for our project. As your project grows, you can include dependencies on third-party modules here. diff --git a/e2e/99_bottles_verbose/neva.yml b/e2e/99_bottles_verbose/neva.yml index d9d42068..dcee4c28 100644 --- a/e2e/99_bottles_verbose/neva.yml +++ b/e2e/99_bottles_verbose/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/add_nums_from_stdin_naive/neva.yml b/e2e/add_nums_from_stdin_naive/neva.yml index d9d42068..dcee4c28 100644 --- a/e2e/add_nums_from_stdin_naive/neva.yml +++ b/e2e/add_nums_from_stdin_naive/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/add_nums_from_stdin_with_default_any/neva.yml b/e2e/add_nums_from_stdin_with_default_any/neva.yml index d9d42068..dcee4c28 100644 --- a/e2e/add_nums_from_stdin_with_default_any/neva.yml +++ b/e2e/add_nums_from_stdin_with_default_any/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/add_nums_from_stdin_with_err_handling/neva.yml b/e2e/add_nums_from_stdin_with_err_handling/neva.yml index d9d42068..dcee4c28 100644 --- a/e2e/add_nums_from_stdin_with_err_handling/neva.yml +++ b/e2e/add_nums_from_stdin_with_err_handling/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/add_nums_from_stdin_with_multuple_senders/neva.yml b/e2e/add_nums_from_stdin_with_multuple_senders/neva.yml index d9d42068..dcee4c28 100644 --- a/e2e/add_nums_from_stdin_with_multuple_senders/neva.yml +++ b/e2e/add_nums_from_stdin_with_multuple_senders/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/add_nums_from_stdin_with_sub_components/neva.yml b/e2e/add_nums_from_stdin_with_sub_components/neva.yml index d9d42068..dcee4c28 100644 --- a/e2e/add_nums_from_stdin_with_sub_components/neva.yml +++ b/e2e/add_nums_from_stdin_with_sub_components/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/add_nums_verbose/neva.yml b/e2e/add_nums_verbose/neva.yml index d9d42068..dcee4c28 100644 --- a/e2e/add_nums_verbose/neva.yml +++ b/e2e/add_nums_verbose/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/array_inport_holes/e2e_test.go b/e2e/array_inport_holes/e2e_test.go index ef0d03ae..d5abf125 100644 --- a/e2e/array_inport_holes/e2e_test.go +++ b/e2e/array_inport_holes/e2e_test.go @@ -18,7 +18,7 @@ func Test(t *testing.T) { require.Contains( t, string(out), - "main/main.neva: array inport 'printf:args' is used incorrectly: slot 1 is missing\n", + "main/main.neva:4:1: array inport 'printf:args' is used incorrectly: slot 1 is missing\n", ) require.Equal(t, 0, cmd.ProcessState.ExitCode()) diff --git a/e2e/array_inport_holes/neva.yml b/e2e/array_inport_holes/neva.yml index d9d42068..dcee4c28 100644 --- a/e2e/array_inport_holes/neva.yml +++ b/e2e/array_inport_holes/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/array_outport_holes/e2e_test.go b/e2e/array_outport_holes/e2e_test.go index d833e471..6f1dcd8f 100644 --- a/e2e/array_outport_holes/e2e_test.go +++ b/e2e/array_outport_holes/e2e_test.go @@ -18,7 +18,7 @@ func Test(t *testing.T) { require.Contains( t, string(out), - "main/main.neva: array outport 'fanOut:data' is used incorrectly: slot 1 is missing\n", + "main/main.neva:4:1: array outport 'fanOut:data' is used incorrectly: slot 1 is missing\n", ) require.Equal(t, 0, cmd.ProcessState.ExitCode()) diff --git a/e2e/array_outport_holes/neva.yml b/e2e/array_outport_holes/neva.yml index d9d42068..dcee4c28 100644 --- a/e2e/array_outport_holes/neva.yml +++ b/e2e/array_outport_holes/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/binary_operators/arithmetic/add/neva.yml b/e2e/binary_operators/arithmetic/add/neva.yml index f51193f3..574efda4 100644 --- a/e2e/binary_operators/arithmetic/add/neva.yml +++ b/e2e/binary_operators/arithmetic/add/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/binary_operators/arithmetic/divide/neva.yml b/e2e/binary_operators/arithmetic/divide/neva.yml index f51193f3..574efda4 100644 --- a/e2e/binary_operators/arithmetic/divide/neva.yml +++ b/e2e/binary_operators/arithmetic/divide/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/binary_operators/arithmetic/modulo/neva.yml b/e2e/binary_operators/arithmetic/modulo/neva.yml index f51193f3..574efda4 100644 --- a/e2e/binary_operators/arithmetic/modulo/neva.yml +++ b/e2e/binary_operators/arithmetic/modulo/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/binary_operators/arithmetic/multiply/neva.yml b/e2e/binary_operators/arithmetic/multiply/neva.yml index f51193f3..574efda4 100644 --- a/e2e/binary_operators/arithmetic/multiply/neva.yml +++ b/e2e/binary_operators/arithmetic/multiply/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/binary_operators/arithmetic/power/neva.yml b/e2e/binary_operators/arithmetic/power/neva.yml index f51193f3..574efda4 100644 --- a/e2e/binary_operators/arithmetic/power/neva.yml +++ b/e2e/binary_operators/arithmetic/power/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/binary_operators/arithmetic/subtract/neva.yml b/e2e/binary_operators/arithmetic/subtract/neva.yml index f51193f3..574efda4 100644 --- a/e2e/binary_operators/arithmetic/subtract/neva.yml +++ b/e2e/binary_operators/arithmetic/subtract/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/binary_operators/bitwise/and/neva.yml b/e2e/binary_operators/bitwise/and/neva.yml index f51193f3..574efda4 100644 --- a/e2e/binary_operators/bitwise/and/neva.yml +++ b/e2e/binary_operators/bitwise/and/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/binary_operators/bitwise/left_shift/neva.yml b/e2e/binary_operators/bitwise/left_shift/neva.yml index f51193f3..574efda4 100644 --- a/e2e/binary_operators/bitwise/left_shift/neva.yml +++ b/e2e/binary_operators/bitwise/left_shift/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/binary_operators/bitwise/or/neva.yml b/e2e/binary_operators/bitwise/or/neva.yml index f51193f3..574efda4 100644 --- a/e2e/binary_operators/bitwise/or/neva.yml +++ b/e2e/binary_operators/bitwise/or/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/binary_operators/bitwise/right_shift/neva.yml b/e2e/binary_operators/bitwise/right_shift/neva.yml index f51193f3..574efda4 100644 --- a/e2e/binary_operators/bitwise/right_shift/neva.yml +++ b/e2e/binary_operators/bitwise/right_shift/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/binary_operators/bitwise/xor/neva.yml b/e2e/binary_operators/bitwise/xor/neva.yml index f51193f3..574efda4 100644 --- a/e2e/binary_operators/bitwise/xor/neva.yml +++ b/e2e/binary_operators/bitwise/xor/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/binary_operators/comparison/equal/neva.yml b/e2e/binary_operators/comparison/equal/neva.yml index f51193f3..574efda4 100644 --- a/e2e/binary_operators/comparison/equal/neva.yml +++ b/e2e/binary_operators/comparison/equal/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/binary_operators/comparison/greater/neva.yml b/e2e/binary_operators/comparison/greater/neva.yml index f51193f3..574efda4 100644 --- a/e2e/binary_operators/comparison/greater/neva.yml +++ b/e2e/binary_operators/comparison/greater/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/binary_operators/comparison/greater_equal/neva.yml b/e2e/binary_operators/comparison/greater_equal/neva.yml index f51193f3..574efda4 100644 --- a/e2e/binary_operators/comparison/greater_equal/neva.yml +++ b/e2e/binary_operators/comparison/greater_equal/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/binary_operators/comparison/less/neva.yml b/e2e/binary_operators/comparison/less/neva.yml index f51193f3..574efda4 100644 --- a/e2e/binary_operators/comparison/less/neva.yml +++ b/e2e/binary_operators/comparison/less/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/binary_operators/comparison/less_equal/neva.yml b/e2e/binary_operators/comparison/less_equal/neva.yml index f51193f3..574efda4 100644 --- a/e2e/binary_operators/comparison/less_equal/neva.yml +++ b/e2e/binary_operators/comparison/less_equal/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/binary_operators/comparison/not_equal/neva.yml b/e2e/binary_operators/comparison/not_equal/neva.yml index f51193f3..574efda4 100644 --- a/e2e/binary_operators/comparison/not_equal/neva.yml +++ b/e2e/binary_operators/comparison/not_equal/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/binary_operators/logical/and/neva.yml b/e2e/binary_operators/logical/and/neva.yml index f51193f3..574efda4 100644 --- a/e2e/binary_operators/logical/and/neva.yml +++ b/e2e/binary_operators/logical/and/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/binary_operators/logical/or/neva.yml b/e2e/binary_operators/logical/or/neva.yml index f51193f3..574efda4 100644 --- a/e2e/binary_operators/logical/or/neva.yml +++ b/e2e/binary_operators/logical/or/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/cli_new/neva.yml b/e2e/cli_new/neva.yml index d9d42068..dcee4c28 100644 --- a/e2e/cli_new/neva.yml +++ b/e2e/cli_new/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/comments/neva.yml b/e2e/comments/neva.yml index d9d42068..dcee4c28 100644 --- a/e2e/comments/neva.yml +++ b/e2e/comments/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/compiler_error_unused_outport/neva.yml b/e2e/compiler_error_unused_outport/neva.yml index d9d42068..dcee4c28 100644 --- a/e2e/compiler_error_unused_outport/neva.yml +++ b/e2e/compiler_error_unused_outport/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/const_refs_verbose/neva.yml b/e2e/const_refs_verbose/neva.yml index d9d42068..dcee4c28 100644 --- a/e2e/const_refs_verbose/neva.yml +++ b/e2e/const_refs_verbose/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/div_test/neva.yml b/e2e/div_test/neva.yml index d9d42068..dcee4c28 100644 --- a/e2e/div_test/neva.yml +++ b/e2e/div_test/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/do_nothing_verbose/neva.yml b/e2e/do_nothing_verbose/neva.yml index d9d42068..dcee4c28 100644 --- a/e2e/do_nothing_verbose/neva.yml +++ b/e2e/do_nothing_verbose/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/duplicate_receiver/neva.yml b/e2e/duplicate_receiver/neva.yml index d9d42068..dcee4c28 100644 --- a/e2e/duplicate_receiver/neva.yml +++ b/e2e/duplicate_receiver/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/duplicate_sender/neva.yml b/e2e/duplicate_sender/neva.yml index d9d42068..dcee4c28 100644 --- a/e2e/duplicate_sender/neva.yml +++ b/e2e/duplicate_sender/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/echo_verbose/neva.yml b/e2e/echo_verbose/neva.yml index d9d42068..dcee4c28 100644 --- a/e2e/echo_verbose/neva.yml +++ b/e2e/echo_verbose/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/enums_verbose/neva.yml b/e2e/enums_verbose/neva.yml index d9d42068..dcee4c28 100644 --- a/e2e/enums_verbose/neva.yml +++ b/e2e/enums_verbose/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/float_const_with_int_lit/neva.yml b/e2e/float_const_with_int_lit/neva.yml index d9d42068..dcee4c28 100644 --- a/e2e/float_const_with_int_lit/neva.yml +++ b/e2e/float_const_with_int_lit/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/for_loop_over_list_verbose/neva.yml b/e2e/for_loop_over_list_verbose/neva.yml index d9d42068..dcee4c28 100644 --- a/e2e/for_loop_over_list_verbose/neva.yml +++ b/e2e/for_loop_over_list_verbose/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/for_with_range_and_if/neva.yml b/e2e/for_with_range_and_if/neva.yml index d9d42068..dcee4c28 100644 --- a/e2e/for_with_range_and_if/neva.yml +++ b/e2e/for_with_range_and_if/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/hello_world_verbose/neva.yml b/e2e/hello_world_verbose/neva.yml index d9d42068..dcee4c28 100644 --- a/e2e/hello_world_verbose/neva.yml +++ b/e2e/hello_world_verbose/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/hello_world_with_const_sender/neva.yml b/e2e/hello_world_with_const_sender/neva.yml index d9d42068..dcee4c28 100644 --- a/e2e/hello_world_with_const_sender/neva.yml +++ b/e2e/hello_world_with_const_sender/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/hello_world_with_implicit_any/neva.yml b/e2e/hello_world_with_implicit_any/neva.yml index d9d42068..dcee4c28 100644 --- a/e2e/hello_world_with_implicit_any/neva.yml +++ b/e2e/hello_world_with_implicit_any/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/hello_world_with_literal_sender/neva.yml b/e2e/hello_world_with_literal_sender/neva.yml index d9d42068..dcee4c28 100644 --- a/e2e/hello_world_with_literal_sender/neva.yml +++ b/e2e/hello_world_with_literal_sender/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/hello_world_with_then_connection/neva.yml b/e2e/hello_world_with_then_connection/neva.yml index d9d42068..dcee4c28 100644 --- a/e2e/hello_world_with_then_connection/neva.yml +++ b/e2e/hello_world_with_then_connection/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/hello_world_with_unnamed_node/neva.yml b/e2e/hello_world_with_unnamed_node/neva.yml index d9d42068..dcee4c28 100644 --- a/e2e/hello_world_with_unnamed_node/neva.yml +++ b/e2e/hello_world_with_unnamed_node/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/inc_test/neva.yml b/e2e/inc_test/neva.yml index d9d42068..dcee4c28 100644 --- a/e2e/inc_test/neva.yml +++ b/e2e/inc_test/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/incompat_comp_type_arg/neva.yml b/e2e/incompat_comp_type_arg/neva.yml index d9d42068..dcee4c28 100644 --- a/e2e/incompat_comp_type_arg/neva.yml +++ b/e2e/incompat_comp_type_arg/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/incompat_types_with_untyped_port/neva.yml b/e2e/incompat_types_with_untyped_port/neva.yml index d9d42068..dcee4c28 100644 --- a/e2e/incompat_types_with_untyped_port/neva.yml +++ b/e2e/incompat_types_with_untyped_port/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/interface_anonymous/neva.yml b/e2e/interface_anonymous/neva.yml index d9d42068..dcee4c28 100644 --- a/e2e/interface_anonymous/neva.yml +++ b/e2e/interface_anonymous/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/interface_verbose/neva.yml b/e2e/interface_verbose/neva.yml index d9d42068..dcee4c28 100644 --- a/e2e/interface_verbose/neva.yml +++ b/e2e/interface_verbose/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/interface_with_imports/neva.yml b/e2e/interface_with_imports/neva.yml index 002dbad0..ddb0917e 100644 --- a/e2e/interface_with_imports/neva.yml +++ b/e2e/interface_with_imports/neva.yml @@ -1,4 +1,4 @@ -neva: 0.27.1 +neva: 0.28.0 deps: github.com/nevalang/x: path: github.com/nevalang/x diff --git a/e2e/list_with_neg_nums/neva.yml b/e2e/list_with_neg_nums/neva.yml index d9d42068..dcee4c28 100644 --- a/e2e/list_with_neg_nums/neva.yml +++ b/e2e/list_with_neg_nums/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/local_imports/neva.yml b/e2e/local_imports/neva.yml index d9d42068..dcee4c28 100644 --- a/e2e/local_imports/neva.yml +++ b/e2e/local_imports/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/map_list_verbose/neva.yml b/e2e/map_list_verbose/neva.yml index d9d42068..dcee4c28 100644 --- a/e2e/map_list_verbose/neva.yml +++ b/e2e/map_list_verbose/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/multiply_numbers/neva.yml b/e2e/multiply_numbers/neva.yml index d9d42068..dcee4c28 100644 --- a/e2e/multiply_numbers/neva.yml +++ b/e2e/multiply_numbers/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/non_unique_fan_in/neva.yml b/e2e/non_unique_fan_in/neva.yml index d9d42068..dcee4c28 100644 --- a/e2e/non_unique_fan_in/neva.yml +++ b/e2e/non_unique_fan_in/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/non_unique_fan_out/neva.yml b/e2e/non_unique_fan_out/neva.yml index d9d42068..dcee4c28 100644 --- a/e2e/non_unique_fan_out/neva.yml +++ b/e2e/non_unique_fan_out/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/order_dependend_with_arr_inport/neva.yml b/e2e/order_dependend_with_arr_inport/neva.yml index d9d42068..dcee4c28 100644 --- a/e2e/order_dependend_with_arr_inport/neva.yml +++ b/e2e/order_dependend_with_arr_inport/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/print_float/neva.yml b/e2e/print_float/neva.yml index d9d42068..dcee4c28 100644 --- a/e2e/print_float/neva.yml +++ b/e2e/print_float/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/regex_submatch_verbose/neva.yml b/e2e/regex_submatch_verbose/neva.yml index d9d42068..dcee4c28 100644 --- a/e2e/regex_submatch_verbose/neva.yml +++ b/e2e/regex_submatch_verbose/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/run_cli_not_from_module_root/neva.yml b/e2e/run_cli_not_from_module_root/neva.yml index d9d42068..dcee4c28 100644 --- a/e2e/run_cli_not_from_module_root/neva.yml +++ b/e2e/run_cli_not_from_module_root/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/simple_fan_out/neva.yml b/e2e/simple_fan_out/neva.yml index d9d42068..dcee4c28 100644 --- a/e2e/simple_fan_out/neva.yml +++ b/e2e/simple_fan_out/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/slow_iteration_with_for/neva.yml b/e2e/slow_iteration_with_for/neva.yml index d9d42068..dcee4c28 100644 --- a/e2e/slow_iteration_with_for/neva.yml +++ b/e2e/slow_iteration_with_for/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/slow_iteration_with_map/neva.yml b/e2e/slow_iteration_with_map/neva.yml index d9d42068..dcee4c28 100644 --- a/e2e/slow_iteration_with_map/neva.yml +++ b/e2e/slow_iteration_with_map/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/struct_builder_verbose/neva.yml b/e2e/struct_builder_verbose/neva.yml index d9d42068..dcee4c28 100644 --- a/e2e/struct_builder_verbose/neva.yml +++ b/e2e/struct_builder_verbose/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/struct_builder_with_sugar/neva.yml b/e2e/struct_builder_with_sugar/neva.yml index d9d42068..dcee4c28 100644 --- a/e2e/struct_builder_with_sugar/neva.yml +++ b/e2e/struct_builder_with_sugar/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/struct_selector_on_port_addr/neva.yml b/e2e/struct_selector_on_port_addr/neva.yml index d9d42068..dcee4c28 100644 --- a/e2e/struct_selector_on_port_addr/neva.yml +++ b/e2e/struct_selector_on_port_addr/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/struct_selector_verbose/neva.yml b/e2e/struct_selector_verbose/neva.yml index d9d42068..dcee4c28 100644 --- a/e2e/struct_selector_verbose/neva.yml +++ b/e2e/struct_selector_verbose/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/struct_selector_with_more_sugar/neva.yml b/e2e/struct_selector_with_more_sugar/neva.yml index d9d42068..dcee4c28 100644 --- a/e2e/struct_selector_with_more_sugar/neva.yml +++ b/e2e/struct_selector_with_more_sugar/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/struct_selector_with_sugar/neva.yml b/e2e/struct_selector_with_sugar/neva.yml index d9d42068..dcee4c28 100644 --- a/e2e/struct_selector_with_sugar/neva.yml +++ b/e2e/struct_selector_with_sugar/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/e2e/type_expr_with_imported_type_arg/neva.yml b/e2e/type_expr_with_imported_type_arg/neva.yml index d9d42068..dcee4c28 100644 --- a/e2e/type_expr_with_imported_type_arg/neva.yml +++ b/e2e/type_expr_with_imported_type_arg/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/examples/neva.yml b/examples/neva.yml index 002dbad0..ddb0917e 100644 --- a/examples/neva.yml +++ b/examples/neva.yml @@ -1,4 +1,4 @@ -neva: 0.27.1 +neva: 0.28.0 deps: github.com/nevalang/x: path: github.com/nevalang/x diff --git a/internal/builder/tests/intergration_test.go b/internal/builder/tests/intergration_test.go index e51f6767..6e884ab8 100644 --- a/internal/builder/tests/intergration_test.go +++ b/internal/builder/tests/intergration_test.go @@ -19,7 +19,7 @@ func TestBuilder_WDIsModRoot(t *testing.T) { mod, ok := build.Modules[build.EntryModRef] require.True(t, ok) require.Len(t, mod.Packages, 1) - require.Equal(t, "0.27.1", mod.Manifest.LanguageVersion) // defined in yml + require.Equal(t, "0.28.0", mod.Manifest.LanguageVersion) // defined in yml pkg, ok := mod.Packages["do_nothing"] require.True(t, ok) @@ -42,7 +42,7 @@ func TestBuilder_WDIsPkg(t *testing.T) { mod, ok := build.Modules[build.EntryModRef] require.True(t, ok) require.Len(t, mod.Packages, 1) - require.Equal(t, "0.27.1", mod.Manifest.LanguageVersion) // defined in yml + require.Equal(t, "0.28.0", mod.Manifest.LanguageVersion) // defined in yml pkg, ok := mod.Packages["do_nothing"] require.True(t, ok) diff --git a/internal/builder/tests/testmod/neva.yml b/internal/builder/tests/testmod/neva.yml index d9d42068..dcee4c28 100644 --- a/internal/builder/tests/testmod/neva.yml +++ b/internal/builder/tests/testmod/neva.yml @@ -1 +1 @@ -neva: 0.27.1 \ No newline at end of file +neva: 0.28.0 \ No newline at end of file diff --git a/std/neva.yml b/std/neva.yml index 72d3c621..4ada77b4 100644 --- a/std/neva.yml +++ b/std/neva.yml @@ -1 +1 @@ -neva: 0.27.1 +neva: 0.28.0