From 71fa98f305da9bec8885a0730d32bbf77f07d0ab Mon Sep 17 00:00:00 2001 From: Konan Denisman Date: Mon, 23 Oct 2023 10:17:04 +0300 Subject: [PATCH] [ets] added tests for 17.14.7 shadowing of function names Signed-off-by: Konan Denisman --- .../shadow_function_alias.ets | 17 +++++++++++++++++ .../shadow_function_explicit_name.ets | 17 +++++++++++++++++ .../shadow_function_name.ets | 17 +++++++++++++++++ .../runner/plugins/ets/ets-cts-ignored.txt | 3 +++ 4 files changed, 54 insertions(+) create mode 100644 plugins/ets/tests/ets-templates/17.experimental_features/14.packages/07.shadowing_of_function_names/shadow_function_alias.ets create mode 100644 plugins/ets/tests/ets-templates/17.experimental_features/14.packages/07.shadowing_of_function_names/shadow_function_explicit_name.ets create mode 100644 plugins/ets/tests/ets-templates/17.experimental_features/14.packages/07.shadowing_of_function_names/shadow_function_name.ets diff --git a/plugins/ets/tests/ets-templates/17.experimental_features/14.packages/07.shadowing_of_function_names/shadow_function_alias.ets b/plugins/ets/tests/ets-templates/17.experimental_features/14.packages/07.shadowing_of_function_names/shadow_function_alias.ets new file mode 100644 index 000000000..b1ef41265 --- /dev/null +++ b/plugins/ets/tests/ets-templates/17.experimental_features/14.packages/07.shadowing_of_function_names/shadow_function_alias.ets @@ -0,0 +1,17 @@ +/*--- +desc: >- + Shadowing is the compile-time error that occurs if an imported function is identical to the function declared in the + current compilation unit (the same names and override-equivalent signatures), i.e., the declarations are duplicated. +tags: [compile-only, negative] +---*/ + +import {max as mymax} from "std/math"; + +function mymax(v: double, u: double): double { + assert false + return v > u ? v : u; +} + +function main(): void { + mymax(1.0, 1.0) +} diff --git a/plugins/ets/tests/ets-templates/17.experimental_features/14.packages/07.shadowing_of_function_names/shadow_function_explicit_name.ets b/plugins/ets/tests/ets-templates/17.experimental_features/14.packages/07.shadowing_of_function_names/shadow_function_explicit_name.ets new file mode 100644 index 000000000..6c6b04e88 --- /dev/null +++ b/plugins/ets/tests/ets-templates/17.experimental_features/14.packages/07.shadowing_of_function_names/shadow_function_explicit_name.ets @@ -0,0 +1,17 @@ +/*--- +desc: >- + Shadowing is the compile-time error that occurs if an imported function is identical to the function declared in the + current compilation unit (the same names and override-equivalent signatures), i.e., the declarations are duplicated. +tags: [compile-only, negative] +---*/ + +import {max} from "std/math"; + +function max(v: double, u: double): double { + assert false + return v > u ? v : u; +} + +function main(): void { + max(1.0, 1.0) +} diff --git a/plugins/ets/tests/ets-templates/17.experimental_features/14.packages/07.shadowing_of_function_names/shadow_function_name.ets b/plugins/ets/tests/ets-templates/17.experimental_features/14.packages/07.shadowing_of_function_names/shadow_function_name.ets new file mode 100644 index 000000000..c44fbbc7f --- /dev/null +++ b/plugins/ets/tests/ets-templates/17.experimental_features/14.packages/07.shadowing_of_function_names/shadow_function_name.ets @@ -0,0 +1,17 @@ +/*--- +desc: >- + Shadowing is the compile-time error that occurs if an imported function is identical to the function declared in the + current compilation unit (the same names and override-equivalent signatures), i.e., the declarations are duplicated. +tags: [compile-only, negative] +---*/ + +import * from "std/math"; + +function min(v: double, u: double): double { + assert false + return v < u ? v : u; +} + +function main(): void { + min(1.0, 1.0) +} diff --git a/tests/tests-u-runner/runner/plugins/ets/ets-cts-ignored.txt b/tests/tests-u-runner/runner/plugins/ets/ets-cts-ignored.txt index 63e4c0c49..c97340bf5 100644 --- a/tests/tests-u-runner/runner/plugins/ets/ets-cts-ignored.txt +++ b/tests/tests-u-runner/runner/plugins/ets/ets-cts-ignored.txt @@ -1935,3 +1935,6 @@ 04.names_declarations_and_scopes/08.function_declarations/03.optional_parameters/opt_param_n_10.ets # end of es2panda fails +17.experimental_features/14.packages/07.shadowing_of_function_names/shadow_function_name.ets +17.experimental_features/14.packages/07.shadowing_of_function_names/shadow_function_explicit_name.ets +17.experimental_features/14.packages/07.shadowing_of_function_names/shadow_function_alias.ets -- Gitee