From 1bfcd63f10bc4ed8bf5fb7722159cd13b06305e9 Mon Sep 17 00:00:00 2001 From: Adam Welc Date: Mon, 4 Nov 2024 17:05:01 -0800 Subject: [PATCH] Added a test --- .../ide_mode/on_dot_autocomplete.exp | 15 +++ .../ide_mode/on_dot_autocomplete.ide | 0 .../ide_mode/on_dot_autocomplete.ide.exp | 105 ++++++++++++++++++ .../ide_mode/on_dot_autocomplete.move | 25 +++++ 4 files changed, 145 insertions(+) create mode 100644 external-crates/move/crates/move-compiler/tests/move_2024/ide_mode/on_dot_autocomplete.exp create mode 100644 external-crates/move/crates/move-compiler/tests/move_2024/ide_mode/on_dot_autocomplete.ide create mode 100644 external-crates/move/crates/move-compiler/tests/move_2024/ide_mode/on_dot_autocomplete.ide.exp create mode 100644 external-crates/move/crates/move-compiler/tests/move_2024/ide_mode/on_dot_autocomplete.move diff --git a/external-crates/move/crates/move-compiler/tests/move_2024/ide_mode/on_dot_autocomplete.exp b/external-crates/move/crates/move-compiler/tests/move_2024/ide_mode/on_dot_autocomplete.exp new file mode 100644 index 0000000000000..d7a3330d71221 --- /dev/null +++ b/external-crates/move/crates/move-compiler/tests/move_2024/ide_mode/on_dot_autocomplete.exp @@ -0,0 +1,15 @@ +warning[W10007]: issue with attribute value + ┌─ tests/move_2024/ide_mode/on_dot_autocomplete.move:1:9 + │ +1 │ #[allow(ide_path_autocomplete)] + │ ^^^^^^^^^^^^^^^^^^^^^ Unknown warning filter 'ide_path_autocomplete' + +error[E04023]: invalid method call + ┌─ tests/move_2024/ide_mode/on_dot_autocomplete.move:23:9 + │ +23 │ c.b.a.b(); // unresolved method name + │ ^^^^^^^^^ + │ │ │ + │ │ No local 'use fun' alias was found for 'a::m::A.b', and no function 'b' was found in the defining module 'a::m' + │ Invalid method call. No known method 'b' on type 'a::m::A' + diff --git a/external-crates/move/crates/move-compiler/tests/move_2024/ide_mode/on_dot_autocomplete.ide b/external-crates/move/crates/move-compiler/tests/move_2024/ide_mode/on_dot_autocomplete.ide new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/external-crates/move/crates/move-compiler/tests/move_2024/ide_mode/on_dot_autocomplete.ide.exp b/external-crates/move/crates/move-compiler/tests/move_2024/ide_mode/on_dot_autocomplete.ide.exp new file mode 100644 index 0000000000000..928a987e3a999 --- /dev/null +++ b/external-crates/move/crates/move-compiler/tests/move_2024/ide_mode/on_dot_autocomplete.ide.exp @@ -0,0 +1,105 @@ +note[I15001]: IDE dot autocomplete + ┌─ tests/move_2024/ide_mode/on_dot_autocomplete.move:21:10 + │ +21 │ c.b.a; // two dots that should trigger auto-completion + │ ^ Possible dot names: 'b' + +note[I15001]: IDE dot autocomplete + ┌─ tests/move_2024/ide_mode/on_dot_autocomplete.move:21:11 + │ +21 │ c.b.a; // two dots that should trigger auto-completion + │ ^ Possible dot names: 'b' + +note[I15001]: IDE dot autocomplete + ┌─ tests/move_2024/ide_mode/on_dot_autocomplete.move:21:12 + │ +21 │ c.b.a; // two dots that should trigger auto-completion + │ ^ Possible dot names: 'a' + +note[I15001]: IDE dot autocomplete + ┌─ tests/move_2024/ide_mode/on_dot_autocomplete.move:21:13 + │ +21 │ c.b.a; // two dots that should trigger auto-completion + │ ^ Possible dot names: 'a' + +note[I15001]: IDE dot autocomplete + ┌─ tests/move_2024/ide_mode/on_dot_autocomplete.move:22:10 + │ +22 │ c.b.a.bar(); // resolved method name + │ ^ Possible dot names: 'b' + +note[I15001]: IDE dot autocomplete + ┌─ tests/move_2024/ide_mode/on_dot_autocomplete.move:22:11 + │ +22 │ c.b.a.bar(); // resolved method name + │ ^ Possible dot names: 'b' + +note[I15001]: IDE dot autocomplete + ┌─ tests/move_2024/ide_mode/on_dot_autocomplete.move:22:12 + │ +22 │ c.b.a.bar(); // resolved method name + │ ^ Possible dot names: 'a' + +note[I15001]: IDE dot autocomplete + ┌─ tests/move_2024/ide_mode/on_dot_autocomplete.move:22:13 + │ +22 │ c.b.a.bar(); // resolved method name + │ ^ Possible dot names: 'a' + +note[I15001]: IDE dot autocomplete + ┌─ tests/move_2024/ide_mode/on_dot_autocomplete.move:22:14 + │ +22 │ c.b.a.bar(); // resolved method name + │ ^ Possible dot names: 'a::m::bar' or 'x' + +note[I15001]: IDE dot autocomplete + ┌─ tests/move_2024/ide_mode/on_dot_autocomplete.move:22:15 + │ +22 │ c.b.a.bar(); // resolved method name + │ ^^^ Possible dot names: 'a::m::bar' or 'x' + +error[E04023]: invalid method call + ┌─ tests/move_2024/ide_mode/on_dot_autocomplete.move:23:9 + │ +23 │ c.b.a.b(); // unresolved method name + │ ^^^^^^^^^ + │ │ │ + │ │ No local 'use fun' alias was found for 'a::m::A.b', and no function 'b' was found in the defining module 'a::m' + │ Invalid method call. No known method 'b' on type 'a::m::A' + +note[I15001]: IDE dot autocomplete + ┌─ tests/move_2024/ide_mode/on_dot_autocomplete.move:23:10 + │ +23 │ c.b.a.b(); // unresolved method name + │ ^ Possible dot names: 'b' + +note[I15001]: IDE dot autocomplete + ┌─ tests/move_2024/ide_mode/on_dot_autocomplete.move:23:11 + │ +23 │ c.b.a.b(); // unresolved method name + │ ^ Possible dot names: 'b' + +note[I15001]: IDE dot autocomplete + ┌─ tests/move_2024/ide_mode/on_dot_autocomplete.move:23:12 + │ +23 │ c.b.a.b(); // unresolved method name + │ ^ Possible dot names: 'a' + +note[I15001]: IDE dot autocomplete + ┌─ tests/move_2024/ide_mode/on_dot_autocomplete.move:23:13 + │ +23 │ c.b.a.b(); // unresolved method name + │ ^ Possible dot names: 'a' + +note[I15001]: IDE dot autocomplete + ┌─ tests/move_2024/ide_mode/on_dot_autocomplete.move:23:14 + │ +23 │ c.b.a.b(); // unresolved method name + │ ^ Possible dot names: 'a::m::bar' or 'x' + +note[I15001]: IDE dot autocomplete + ┌─ tests/move_2024/ide_mode/on_dot_autocomplete.move:23:15 + │ +23 │ c.b.a.b(); // unresolved method name + │ ^ Possible dot names: 'a::m::bar' or 'x' + diff --git a/external-crates/move/crates/move-compiler/tests/move_2024/ide_mode/on_dot_autocomplete.move b/external-crates/move/crates/move-compiler/tests/move_2024/ide_mode/on_dot_autocomplete.move new file mode 100644 index 0000000000000..f6c41714cf093 --- /dev/null +++ b/external-crates/move/crates/move-compiler/tests/move_2024/ide_mode/on_dot_autocomplete.move @@ -0,0 +1,25 @@ +#[allow(ide_path_autocomplete)] +module a::m { + + public struct A has copy, drop { + x: u64 + } + + public struct B has copy, drop { + a: A + } + + public struct C has copy, drop { + b: B + } + + public fun bar(_a: A) {} + + public fun foo() { + let b = B { a: A { x: 0 } }; + let c = C { b: b }; + c.b.a; // two dots that should trigger auto-completion + c.b.a.bar(); // resolved method name + c.b.a.b(); // unresolved method name + } +}