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

feat(hydroflow_lang): singletons full implementation except for stratification #797 #1065 (2/x) #1133

Merged
merged 3 commits into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions hydroflow/tests/compile-fail/surface_singleton_nostate.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/// Reference an operator that doesn't have singleton state.
pub fn main() {
let mut df = hydroflow::hydroflow_syntax! {
my_ref = source_iter(15..=25) -> null();
source_iter(10..=30)
-> filter(|value| value <= #my_ref.as_reveal_ref())
-> null();

};
df.run_available();
}
5 changes: 5 additions & 0 deletions hydroflow/tests/compile-fail/surface_singleton_nostate.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
error: Cannot reference operator `null`. Only operators with singleton state can be referenced.
--> tests/compile-fail/surface_singleton_nostate.rs:6:41
|
6 | -> filter(|value| value <= #my_ref.as_reveal_ref())
| ^^^^^^
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
pub fn main() {
let mut df = hydroflow::hydroflow_syntax! {
my_ref = source_iter(15..=25) -> null();
source_iter(10..=30)
-> filter(|value| value <= #my_ref.as_reveal_ref() && value <= #unknown.as_reveal_ref())
-> null();
};
df.run_available();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
error: Cannot find referenced name `unknown`; name was never assigned.
--> tests/compile-fail/surface_singleton_nostate_undefined.rs:5:77
|
5 | -> filter(|value| value <= #my_ref.as_reveal_ref() && value <= #unknown.as_reveal_ref())
| ^^^^^^^

error: Cannot reference operator `null`. Only operators with singleton state can be referenced.
--> tests/compile-fail/surface_singleton_nostate_undefined.rs:5:41
|
5 | -> filter(|value| value <= #my_ref.as_reveal_ref() && value <= #unknown.as_reveal_ref())
| ^^^^^^
8 changes: 8 additions & 0 deletions hydroflow/tests/compile-fail/surface_singleton_undefined.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
pub fn main() {
let mut df = hydroflow::hydroflow_syntax! {
source_iter(10..=30)
-> filter(|value| value <= #unknown.as_reveal_ref())
-> null();
};
df.run_available();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
error: Cannot find referenced name `unknown`; name was never assigned.
--> tests/compile-fail/surface_singleton_undefined.rs:4:41
|
4 | -> filter(|value| value <= #unknown.as_reveal_ref())
| ^^^^^^^
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
pub fn main() {
let mut df = hydroflow::hydroflow_syntax! {
my_ref = source_iter(15..=25) -> null();
source_iter(10..=30)
-> filter(|value| value <= #unknown.as_reveal_ref() && value <= #my_ref.as_reveal_ref())
-> null();
};
df.run_available();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
error: Cannot find referenced name `unknown`; name was never assigned.
--> tests/compile-fail/surface_singleton_undefined_nostate.rs:5:41
|
5 | -> filter(|value| value <= #unknown.as_reveal_ref() && value <= #my_ref.as_reveal_ref())
| ^^^^^^^

error: Cannot reference operator `null`. Only operators with singleton state can be referenced.
--> tests/compile-fail/surface_singleton_undefined_nostate.rs:5:78
|
5 | -> filter(|value| value <= #unknown.as_reveal_ref() && value <= #my_ref.as_reveal_ref())
| ^^^^^^
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
error: Cannot find name `hydro_lab`; name was never assigned.
--> tests/compile-fail/surface_undefined_variable.rs:5:9
--> tests/compile-fail/surface_varname_undefined.rs:5:9
|
5 | hydro_lab -> for_each(std::mem::drop);
| ^^^^^^^^^

error: `for_each` must have exactly 1 input(s), actually has 0.
--> tests/compile-fail/surface_undefined_variable.rs:5:22
--> tests/compile-fail/surface_varname_undefined.rs:5:22
|
5 | hydro_lab -> for_each(std::mem::drop);
| ^^^^^^^^^^^^^^^^^^^^^^^^
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
source: hydroflow/tests/surface_singleton.rs
expression: "df.meta_graph().unwrap().to_dot(&Default::default())"
---
digraph {
node [fontname="Monaco,Menlo,Consolas,&quot;Droid Sans Mono&quot;,Inconsolata,&quot;Courier New&quot;,monospace", style=filled];
edge [fontname="Monaco,Menlo,Consolas,&quot;Droid Sans Mono&quot;,Inconsolata,&quot;Courier New&quot;,monospace"];
n1v1 [label="(n1v1) source_iter_delta(15..=25)", shape=invhouse, fillcolor="#88aaff"]
n2v1 [label="(n2v1) map(Max::new)", shape=invhouse, fillcolor="#88aaff"]
n3v1 [label="(n3v1) state_ref::<Max<_>>()", shape=house, fillcolor="#ffff88"]
n1v1 -> n2v1 [color=darkgreen, style=dashed]
n2v1 -> n3v1 [color=darkgreen, style=dashed]
subgraph "cluster n1v1" {
fillcolor="#dddddd"
style=filled
label = "sg_1v1\nstratum 0"
n1v1
n2v1
n3v1
subgraph "cluster_sg_1v1_var_stream2" {
label="var stream2"
n1v1
n2v1
}
subgraph "cluster_sg_1v1_var_sum_of_stream2" {
label="var sum_of_stream2"
n3v1
}
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
source: hydroflow/tests/surface_singleton.rs
expression: "df.meta_graph().unwrap().to_mermaid(&Default::default())"
---
%%{init:{'theme':'base','themeVariables':{'clusterBkg':'#ddd','clusterBorder':'#888'}}}%%
flowchart TD
classDef pullClass fill:#8af,stroke:#000,text-align:left,white-space:pre
classDef pushClass fill:#ff8,stroke:#000,text-align:left,white-space:pre
classDef otherClass fill:#fdc,stroke:#000,text-align:left,white-space:pre
linkStyle default stroke:#aaa
1v1[\"(1v1) <code>source_iter_delta(15..=25)</code>"/]:::pullClass
2v1[\"(2v1) <code>map(Max::new)</code>"/]:::pullClass
3v1[/"(3v1) <code>state_ref::&lt;Max&lt;_&gt;&gt;()</code>"\]:::pushClass
1v1-.->2v1; linkStyle 0 stroke:#060
2v1-.->3v1; linkStyle 1 stroke:#060
subgraph sg_1v1 ["sg_1v1 stratum 0"]
1v1
2v1
3v1
subgraph sg_1v1_var_stream2 ["var <tt>stream2</tt>"]
1v1
2v1
end
subgraph sg_1v1_var_sum_of_stream2 ["var <tt>sum_of_stream2</tt>"]
3v1
end
end

This file was deleted.

This file was deleted.

This file was deleted.

Loading
Loading