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

test: drun test for pattern-based imports #3081

Merged
merged 59 commits into from
Jan 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
b46e72a
first shot at #2354
ggreif Jan 27, 2022
e6e9915
add test
ggreif Jan 27, 2022
67500bf
improve a bit
ggreif Jan 27, 2022
2d40582
unit grooming
ggreif Jan 27, 2022
1556274
cleaner
ggreif Jan 27, 2022
3b120ee
resolve the type error at the access site
ggreif Jan 27, 2022
bcf3fcb
resolve the module vs. field of module ambiguity
ggreif Jan 27, 2022
59efd68
thread the module note through
ggreif Jan 27, 2022
957f912
clean up
ggreif Jan 27, 2022
a1ee29c
get the module `VarE`'s type right
ggreif Jan 27, 2022
91c3708
cleanup
ggreif Jan 27, 2022
8d7fb3c
make it `'import' <pat_nullary> '='? <text>`
ggreif Jan 27, 2022
8fe6866
pointless
ggreif Jan 27, 2022
ddcef0f
also pointless
ggreif Jan 27, 2022
f581947
Update src/mo_frontend/parser.mly
ggreif Jan 27, 2022
0eff5af
capture the entire pattern
ggreif Jan 27, 2022
999d654
cleanups
ggreif Jan 27, 2022
c32448f
make `comp_unit_of_prog` linear-time
ggreif Jan 27, 2022
58c629c
Revert "pointless"
ggreif Jan 27, 2022
ad314b7
Revert "also pointless"
ggreif Jan 27, 2022
2e9df25
use modern syntax
ggreif Jan 27, 2022
7293902
fix repl tests
ggreif Jan 27, 2022
93dcc88
a few dodgy imports
ggreif Jan 28, 2022
1a0a069
accept
ggreif Jan 28, 2022
e72ce22
more failure modes
ggreif Jan 28, 2022
d43c7ab
ignore explicit imports for now
ggreif Jan 28, 2022
3669465
ocamlformat
ggreif Jan 28, 2022
6efb5f6
mention explicit imports
ggreif Jan 28, 2022
b109d6d
typo
ggreif Jan 28, 2022
4c94e00
teach IR typechecker to reject refutable import patterns
ggreif Jan 28, 2022
1eef8dc
document the new syntax for imports
ggreif Jan 28, 2022
e3ee5f1
show how specific bindings can be imported
ggreif Jan 28, 2022
968cadc
demonstrate renaming on import
ggreif Jan 28, 2022
9c911ca
it is `<pat>` now
ggreif Jan 28, 2022
2c3f4aa
Update doc/modules/language-guide/pages/overview.adoc
ggreif Jan 28, 2022
2503343
DRY
ggreif Jan 28, 2022
0e0b65a
Update src/docs/extract.ml
ggreif Jan 28, 2022
656b48c
Update doc/modules/language-guide/pages/language-manual.adoc
ggreif Jan 28, 2022
9dc287a
Update doc/modules/language-guide/pages/language-manual.adoc
ggreif Jan 28, 2022
c59e85a
Update doc/modules/language-guide/pages/language-manual.adoc
ggreif Jan 28, 2022
a2aeae4
Update src/ir_def/check_ir.ml
ggreif Jan 28, 2022
d0dff31
remove cruft
ggreif Jan 28, 2022
2d9b797
use the coverage checker to reject refutable import patterns
ggreif Jan 28, 2022
37b2838
Update doc/modules/language-guide/pages/language-manual.adoc
ggreif Jan 28, 2022
c763ff8
Update src/ir_def/check_ir.ml
ggreif Jan 28, 2022
feec77b
back
ggreif Jan 28, 2022
988c27f
forgotten
ggreif Jan 28, 2022
c98c798
add example
ggreif Jan 28, 2022
a3ac786
ooops
ggreif Jan 28, 2022
2ae3cbb
Update doc/modules/language-guide/pages/language-manual.adoc
ggreif Jan 28, 2022
3e8226c
Update language-manual.adoc
ggreif Jan 28, 2022
b5ed7d0
reindent
ggreif Jan 28, 2022
1ddcf93
tweak again
ggreif Jan 28, 2022
95a93a8
Merge branch 'master' into gabor/deconstruct-import
ggreif Jan 28, 2022
ca01c14
move an item
ggreif Jan 28, 2022
af6941a
demonstrate that actor methods cannot be imported explicitly
ggreif Jan 28, 2022
992b083
drun test for pattern-based imports
crusso Jan 28, 2022
8a810ac
Update test/run-drun/import-pat/A.mo
crusso Jan 28, 2022
1ded74a
Merge branch 'master' into claudio/deconstruct-import
ggreif Jan 28, 2022
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
27 changes: 27 additions & 0 deletions test/run-drun/import-pat.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// test pattern matching imports
import P "mo:⛔";

import A = "import-pat/A";

import {
// type T; // TBC
start;
inc = next
} = "import-pat/A";

import {
// type T; // TBC
start = begin;
inc
} = "import-pat/A";



actor {

type U = A.T;
P.debugPrint(debug_show(A.inc(A.start)));
P.debugPrint(debug_show(next(start)));
P.debugPrint(debug_show(inc(begin)));

}
6 changes: 6 additions & 0 deletions test/run-drun/import-pat/A.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module {
public type T = Nat;
public let start = 0;

public func inc(x : T) : T { x+1; };
}
5 changes: 5 additions & 0 deletions test/run-drun/ok/import-pat.drun-run.ok
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ingress Completed: Reply: 0x4449444c016c01b3c4b1f204680100010a00000000000000000101
debug.print: 1
debug.print: 1
debug.print: 1
ingress Completed: Reply: 0x4449444c0000
7 changes: 7 additions & 0 deletions test/run-drun/ok/import-pat.ic-ref-run.ok
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
→ update create_canister(record {settings = null})
← replied: (record {hymijyo = principal "cvccv-qqaaq-aaaaa-aaaaa-c"})
→ update install_code(record {arg = blob ""; kca_xin = blob "\00asm\01\00\00\00\0…
debug.print: 1
debug.print: 1
debug.print: 1
← replied: ()
3 changes: 3 additions & 0 deletions test/run-drun/ok/import-pat.run-ir.ok
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
1
1
1
3 changes: 3 additions & 0 deletions test/run-drun/ok/import-pat.run-low.ok
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
1
1
1
3 changes: 3 additions & 0 deletions test/run-drun/ok/import-pat.run.ok
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
1
1
1