diff --git a/ada/nodes.lkt b/ada/nodes.lkt index fda7b05ce..7243fa3f4 100644 --- a/ada/nodes.lkt +++ b/ada/nodes.lkt @@ -6571,6 +6571,14 @@ class ClasswideTypeDecl: BaseTypeDecl { @with_dynvars(origin) fun is_iterable_type(): Bool = self.type_decl().is_iterable_type() + fun has_ud_indexing(): Bool = self.type_decl.has_ud_indexing + + fun constant_indexing_fns(): Array[Entity[BasicDecl]] = + self.type_decl.constant_indexing_fns + + fun variable_indexing_fns(): Array[Entity[BasicDecl]] = + self.type_decl.variable_indexing_fns + fun is_task_type(): Bool = self.type_decl().is_task_type() @with_dynvars(origin) diff --git a/testsuite/tests/name_resolution/ud_indexing_7/test.adb b/testsuite/tests/name_resolution/ud_indexing_7/test.adb new file mode 100644 index 000000000..0abcf3783 --- /dev/null +++ b/testsuite/tests/name_resolution/ud_indexing_7/test.adb @@ -0,0 +1,35 @@ +procedure Test is + package String_Vector is + type Virtual_String_Vector is tagged private with + Constant_Indexing => Element; + + function Element + (Self : Virtual_String_Vector'Class; + Index : Positive) return Character; + private + type Virtual_String_Vector is tagged record + Data : Character; + end record; + end String_Vector; + + package body String_Vector is + function Element + (Self : Virtual_String_Vector'Class; + Index : Positive) return Character is + begin + return 'x'; + end; + end String_Vector; + + use String_Vector; + + + procedure P (X : Virtual_String_Vector'Class) is + C : Character; + begin + C := X (1); + pragma Test_Statement; + end P; +begin + null; +end; diff --git a/testsuite/tests/name_resolution/ud_indexing_7/test.out b/testsuite/tests/name_resolution/ud_indexing_7/test.out new file mode 100644 index 000000000..3344f3f5c --- /dev/null +++ b/testsuite/tests/name_resolution/ud_indexing_7/test.out @@ -0,0 +1,25 @@ +Analyzing test.adb +################## + +Resolving xrefs for node +********************************************************* + +Expr: + references: + type: + expected type: None +Expr: + references: + type: + expected type: +Expr: + references: + type: + expected type: None +Expr: + references: None + type: + expected type: + + +Done. diff --git a/testsuite/tests/name_resolution/ud_indexing_7/test.yaml b/testsuite/tests/name_resolution/ud_indexing_7/test.yaml new file mode 100644 index 000000000..173e325ff --- /dev/null +++ b/testsuite/tests/name_resolution/ud_indexing_7/test.yaml @@ -0,0 +1,2 @@ +driver: name-resolution +input_sources: [test.adb]