From f22f8045d3d0ec79f1312b84e773ec500c4eb69a Mon Sep 17 00:00:00 2001 From: Maksim Kurnikov Date: Thu, 16 Jan 2025 18:13:04 +0100 Subject: [PATCH 1/8] set Move 2 as default --- .../cli/settings/MvProjectSettingsService.kt | 2 +- .../names/DotAccessCompletionTest.kt | 2 +- .../compilerV2/ReceiverStyleFunctionTest.kt | 20 +++++++++++++++++++ ...ith_multiple_module_single_test_module.xml | 2 +- .../run_tests_for_file_with_one_module.xml | 2 +- ...unction_if_inside_non_test_only_module.xml | 2 +- ...un_tests_for_module_with_test_function.xml | 2 +- .../run_tests_for_move_package_from_root.xml | 2 +- ..._for_move_package_from_tests_directory.xml | 2 +- .../test/run_tests_for_move_toml_file.xml | 2 +- ...t_run_for_compiler_v2_without_cli_flag.xml | 2 +- .../test/test_run_for_function.xml | 2 +- ...function_dumping_state_on_test_failure.xml | 2 +- ...n_for_function_skipping_fetch_git_deps.xml | 2 +- ...ule_with_test_functions_inside_sources.xml | 2 +- 15 files changed, 34 insertions(+), 14 deletions(-) diff --git a/src/main/kotlin/org/move/cli/settings/MvProjectSettingsService.kt b/src/main/kotlin/org/move/cli/settings/MvProjectSettingsService.kt index 34a9c0298..e44cfd5db 100644 --- a/src/main/kotlin/org/move/cli/settings/MvProjectSettingsService.kt +++ b/src/main/kotlin/org/move/cli/settings/MvProjectSettingsService.kt @@ -61,7 +61,7 @@ class MvProjectSettingsService( var dumpStateOnTestFailure: Boolean by property(false) @AffectsHighlighting - var enableMove2: Boolean by property(false) + var enableMove2: Boolean by property(true) override fun copy(): MoveProjectSettings { val state = MoveProjectSettings() diff --git a/src/test/kotlin/org/move/lang/completion/names/DotAccessCompletionTest.kt b/src/test/kotlin/org/move/lang/completion/names/DotAccessCompletionTest.kt index e4a362eaf..07d6da834 100644 --- a/src/test/kotlin/org/move/lang/completion/names/DotAccessCompletionTest.kt +++ b/src/test/kotlin/org/move/lang/completion/names/DotAccessCompletionTest.kt @@ -87,7 +87,7 @@ module 0x1::M { """) fun `test no duplicate completions for enum variant fields`() = checkContainsCompletionExact( - listOf("field_x", "field_y", "field_z"), + listOf("field_x", "field_y", "field_z", "t9_common_field"), """ module 0x1::m { enum CommonFields { diff --git a/src/test/kotlin/org/move/lang/resolve/compilerV2/ReceiverStyleFunctionTest.kt b/src/test/kotlin/org/move/lang/resolve/compilerV2/ReceiverStyleFunctionTest.kt index b57d32df9..1282be2c9 100644 --- a/src/test/kotlin/org/move/lang/resolve/compilerV2/ReceiverStyleFunctionTest.kt +++ b/src/test/kotlin/org/move/lang/resolve/compilerV2/ReceiverStyleFunctionTest.kt @@ -265,4 +265,24 @@ class ReceiverStyleFunctionTest: ResolveTestCase() { } } """) + + @MoveV2 + fun `test enum with receiver function from a call expr`() = checkByCode(""" + module 0x1::m { + enum Ordering has copy, drop { + Less, + Equal, + Greater, + } + native public fun compare(first: &T, second: &T): Ordering; + public fun is_eq(self: &Ordering): bool { + //X + self is Ordering::Equal + } + fun main() { + compare(&1, &1).is_eq(); + //^ + } + } + """) } \ No newline at end of file diff --git a/src/test/resources/org/move/cli/producers.fixtures/test/run_tests_for_file_with_multiple_module_single_test_module.xml b/src/test/resources/org/move/cli/producers.fixtures/test/run_tests_for_file_with_multiple_module_single_test_module.xml index ee8001009..7e4f0af67 100644 --- a/src/test/resources/org/move/cli/producers.fixtures/test/run_tests_for_file_with_multiple_module_single_test_module.xml +++ b/src/test/resources/org/move/cli/producers.fixtures/test/run_tests_for_file_with_multiple_module_single_test_module.xml @@ -1,6 +1,6 @@ -