From f59cbfca97291603d0b72f0df328208a9ce10f08 Mon Sep 17 00:00:00 2001 From: Romain Beguet Date: Mon, 20 Nov 2023 16:21:22 +0100 Subject: [PATCH] Test concatenation with visible overloads. --- .../concat_op_overloading/pkg.ads | 3 + .../concat_op_overloading/test.adb | 16 +++ .../concat_op_overloading/test.out | 109 ++++++++++++++++++ .../concat_op_overloading/test.yaml | 2 + .../concat_op_overloading/test_2.adb | 15 +++ 5 files changed, 145 insertions(+) create mode 100644 testsuite/tests/name_resolution/concat_op_overloading/pkg.ads create mode 100644 testsuite/tests/name_resolution/concat_op_overloading/test.adb create mode 100644 testsuite/tests/name_resolution/concat_op_overloading/test.out create mode 100644 testsuite/tests/name_resolution/concat_op_overloading/test.yaml create mode 100644 testsuite/tests/name_resolution/concat_op_overloading/test_2.adb diff --git a/testsuite/tests/name_resolution/concat_op_overloading/pkg.ads b/testsuite/tests/name_resolution/concat_op_overloading/pkg.ads new file mode 100644 index 000000000..c458c68ee --- /dev/null +++ b/testsuite/tests/name_resolution/concat_op_overloading/pkg.ads @@ -0,0 +1,3 @@ +package Pkg is + function "&" (X, Y : String) return String is (X); +end Pkg; diff --git a/testsuite/tests/name_resolution/concat_op_overloading/test.adb b/testsuite/tests/name_resolution/concat_op_overloading/test.adb new file mode 100644 index 000000000..dce653dd3 --- /dev/null +++ b/testsuite/tests/name_resolution/concat_op_overloading/test.adb @@ -0,0 +1,16 @@ +with Ada.Text_IO; +with Pkg; + +procedure Test is + use Pkg; + + A, B : constant String := "hello"; + + C : String := "&" (A, B); + pragma Test_Statement; + D : String := A & B; + pragma Test_Statement; +begin + Ada.Text_IO.Put_Line (C); + Ada.Text_IO.Put_Line (D); +end Test; diff --git a/testsuite/tests/name_resolution/concat_op_overloading/test.out b/testsuite/tests/name_resolution/concat_op_overloading/test.out new file mode 100644 index 000000000..96f557ed6 --- /dev/null +++ b/testsuite/tests/name_resolution/concat_op_overloading/test.out @@ -0,0 +1,109 @@ +Analyzing test.adb +################## + +Resolving xrefs for node +************************************************************* + +Expr: + references: + type: None + expected type: None +Expr: + references: + type: + expected type: +Expr: + references: + type: + expected type: None +Expr: + references: + type: + expected type: +Expr: + references: + type: + expected type: + +Resolving xrefs for node +*************************************************************** + +Expr: + references: + type: None + expected type: None +Expr: + type: + expected type: +Expr: + references: + type: + expected type: +Expr: + type: + expected type: +Expr: + references: + type: None + expected type: None +Expr: + references: + type: + expected type: + + +Analyzing test_2.adb +#################### + +Resolving xrefs for node +*************************************************************** + +Expr: + references: + type: None + expected type: None +Expr: + references: + type: + expected type: +Expr: + references: + type: + expected type: None +Expr: + references: + type: + expected type: +Expr: + references: + type: + expected type: + +Resolving xrefs for node +***************************************************************** + +Expr: + references: + type: None + expected type: None +Expr: + type: + expected type: +Expr: + references: + type: + expected type: +Expr: + type: + expected type: +Expr: + references: + type: None + expected type: None +Expr: + references: + type: + expected type: + + +Done. diff --git a/testsuite/tests/name_resolution/concat_op_overloading/test.yaml b/testsuite/tests/name_resolution/concat_op_overloading/test.yaml new file mode 100644 index 000000000..79c9040c2 --- /dev/null +++ b/testsuite/tests/name_resolution/concat_op_overloading/test.yaml @@ -0,0 +1,2 @@ +driver: name-resolution +input_sources: [test.adb, test_2.adb] diff --git a/testsuite/tests/name_resolution/concat_op_overloading/test_2.adb b/testsuite/tests/name_resolution/concat_op_overloading/test_2.adb new file mode 100644 index 000000000..90906fca0 --- /dev/null +++ b/testsuite/tests/name_resolution/concat_op_overloading/test_2.adb @@ -0,0 +1,15 @@ +with Ada.Text_IO; + +procedure Test_2 is + function "&" (X, Y : String) return String is (X); + + A, B : constant String := "hello"; + + C : String := "&" (A, B); + pragma Test_Statement; + D : String := A & B; + pragma Test_Statement; +begin + Ada.Text_IO.Put_Line (C); + Ada.Text_IO.Put_Line (D); +end Test_2;