-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(hydroflow_lang): track which ops have singleton state (#1091)
Add a nice error message for referencing a non-singleton op
- Loading branch information
1 parent
3876db7
commit 372cbea
Showing
81 changed files
with
220 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 4 additions & 19 deletions
23
hydroflow/tests/compile-fail/surface_singleton_nostate.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,5 @@ | ||
error[E0425]: cannot find value `singleton_op_2v1` in this scope | ||
--> tests/compile-fail/surface_singleton_nostate.rs:5:16 | ||
error: Cannot reference operator `null`. Only operators with singleton state can be referenced. | ||
--> tests/compile-fail/surface_singleton_nostate.rs:6:41 | ||
| | ||
5 | -> filter(|value| value <= #my_ref.as_reveal_ref()) | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope | ||
|
||
error[E0282]: type annotations needed | ||
--> tests/compile-fail/surface_singleton_nostate.rs:2:18 | ||
| | ||
2 | let mut df = hydroflow::hydroflow_syntax! { | ||
| __________________^ | ||
3 | | my_ref = source_iter(15..=25) -> null(); | ||
4 | | source_iter(10..=30) | ||
5 | | -> filter(|value| value <= #my_ref.as_reveal_ref()) | ||
6 | | -> null(); | ||
7 | | | ||
8 | | }; | ||
| |_____^ cannot infer type | ||
| | ||
= note: this error originates in the macro `hydroflow::hydroflow_syntax` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
6 | -> filter(|value| value <= #my_ref.as_reveal_ref()) | ||
| ^^^^^^ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
31 changes: 31 additions & 0 deletions
31
hydroflow/tests/snapshots/surface_singleton__state_ref_unused@graphvis_dot.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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,"Droid Sans Mono",Inconsolata,"Courier New",monospace", style=filled]; | ||
edge [fontname="Monaco,Menlo,Consolas,"Droid Sans Mono",Inconsolata,"Courier New",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 | ||
} | ||
} | ||
} | ||
|
28 changes: 28 additions & 0 deletions
28
hydroflow/tests/snapshots/surface_singleton__state_ref_unused@graphvis_mermaid.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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::<Max<_>>()</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 contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.