Skip to content

Commit 312f94c

Browse files
committed
library/tools: check validity of convert clauses. Validity errors VYCP and VYCQ.
gecop: added validation tests for `VYCP` (Conversion Procedure rule) and `VYCQ` (Conversion Query rule).
2 parents 1ccd9a4 + 54b91e7 commit 312f94c

451 files changed

Lines changed: 8718 additions & 247 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

History.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# Release History
22

3+
## Version xx.xx.xx - xxxxxx
4+
5+
### gecop
6+
7+
* Added validation tests for `VYCP` (Conversion Procedure rule) and
8+
`VYCQ` (Conversion Query rule).
9+
10+
### Gobo Eiffel Tools Library
11+
12+
* Check validity of convert clauses. Validity errors `VYCP` and `VYCQ`.
13+
314
## Version 26.05.14 - 14 May 2026
415

516
### gec

library/tools/src/eiffel/ast/class/et_class.e

Lines changed: 57 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -255,9 +255,6 @@ feature -- Initialization
255255
if attached creators as l_creators then
256256
l_creators.reset
257257
end
258-
if attached convert_features as l_convert_features then
259-
l_convert_features.reset
260-
end
261258
ensure
262259
same_name: name = old name
263260
same_id: id = old id
@@ -280,6 +277,9 @@ feature -- Initialization
280277
reset_interface_checked
281278
queries.reset_after_features_flattened
282279
procedures.reset_after_features_flattened
280+
if attached convert_features as l_convert_features then
281+
l_convert_features.reset
282+
end
283283
if attached formal_parameters as l_formal_parameters then
284284
l_formal_parameters.reset_constraint_renames
285285
l_formal_parameters.reset_constraint_creation_procedures
@@ -2482,6 +2482,60 @@ feature -- Conversion
24822482
end
24832483
end
24842484

2485+
has_convert_to_with_base_class (a_class: ET_CLASS): BOOLEAN
2486+
-- Is there a conversion query whose convert type's base class is `a_class`?
2487+
require
2488+
a_class_not_void: a_class /= Void
2489+
local
2490+
i, nb: INTEGER
2491+
a_feature: ET_CONVERT_FEATURE
2492+
other_type: ET_TYPE
2493+
do
2494+
if attached convert_features as l_convert_features then
2495+
other_type := tokens.identity_type
2496+
nb := l_convert_features.count
2497+
from i := 1 until i > nb loop
2498+
a_feature := l_convert_features.convert_feature (i)
2499+
if a_feature.is_convert_to then
2500+
-- Do not take into account the attachment and
2501+
-- separateness status of the types involved.
2502+
if a_feature.types.has_base_class (a_class, Current) then
2503+
Result := True
2504+
i := nb + 1 -- Jump out of the loop.
2505+
end
2506+
end
2507+
i := i + 1
2508+
end
2509+
end
2510+
end
2511+
2512+
has_convert_from_with_base_class (a_class: ET_CLASS): BOOLEAN
2513+
-- Is there a conversion procedure whose convert type's base class is `a_class`?
2514+
require
2515+
a_class_not_void: a_class /= Void
2516+
local
2517+
i, nb: INTEGER
2518+
a_feature: ET_CONVERT_FEATURE
2519+
other_type: ET_TYPE
2520+
do
2521+
if attached convert_features as l_convert_features then
2522+
other_type := tokens.identity_type
2523+
nb := l_convert_features.count
2524+
from i := 1 until i > nb loop
2525+
a_feature := l_convert_features.convert_feature (i)
2526+
if a_feature.is_convert_from then
2527+
-- Do not take into account the attachment and
2528+
-- separateness status of the types involved.
2529+
if a_feature.types.has_base_class (a_class, Current) then
2530+
Result := True
2531+
i := nb + 1 -- Jump out of the loop.
2532+
end
2533+
end
2534+
i := i + 1
2535+
end
2536+
end
2537+
end
2538+
24852539
convert_features: detachable ET_CONVERT_FEATURE_LIST
24862540
-- Conversion clauses
24872541

library/tools/src/eiffel/ast/feature/et_deferred_function.e

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"Eiffel deferred-functions"
66

77
library: "Gobo Eiffel Tools Library"
8-
copyright: "Copyright (c) 1999-2024, Eric Bezault and others"
8+
copyright: "Copyright (c) 1999-2026, Eric Bezault and others"
99
license: "MIT License"
1010

1111
class ET_DEFERRED_FUNCTION
@@ -21,8 +21,12 @@ inherit
2121

2222
ET_DEFERRED_ROUTINE
2323
undefine
24-
reset, type, is_prefixable, is_infixable,
25-
is_bracketable, is_function
24+
reset_after_features_flattened,
25+
type,
26+
is_prefixable,
27+
is_infixable,
28+
is_bracketable,
29+
is_function
2630
end
2731

2832
create

library/tools/src/eiffel/ast/feature/et_dotnet_function.e

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"Functions implemented in .NET"
66

77
library: "Gobo Eiffel Tools Library"
8-
copyright: "Copyright (c) 2006-2024, Eric Bezault and others"
8+
copyright: "Copyright (c) 2006-2026, Eric Bezault and others"
99
license: "MIT License"
1010

1111
class ET_DOTNET_FUNCTION
@@ -39,8 +39,12 @@ inherit
3939

4040
ET_DOTNET_ROUTINE
4141
undefine
42-
reset, type, is_prefixable, is_infixable,
43-
is_bracketable, is_function
42+
reset_after_features_flattened,
43+
type,
44+
is_prefixable,
45+
is_infixable,
46+
is_bracketable,
47+
is_function
4448
end
4549

4650
create

library/tools/src/eiffel/ast/feature/et_dotnet_query.e

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"Queries (functions or attributes) implemented in .NET"
66

77
library: "Gobo Eiffel Tools Library"
8-
copyright: "Copyright (c) 2006-2017, Eric Bezault and others"
8+
copyright: "Copyright (c) 2006-2026, Eric Bezault and others"
99
license: "MIT License"
1010

1111
deferred class ET_DOTNET_QUERY
@@ -21,7 +21,7 @@ inherit
2121

2222
ET_DOTNET_FEATURE
2323
undefine
24-
reset, type
24+
reset_after_features_flattened, type
2525
end
2626

2727
end

library/tools/src/eiffel/ast/feature/et_extended_attribute.e

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"Eiffel variable attributes with extended syntax"
66

77
library: "Gobo Eiffel Tools Library"
8-
copyright: "Copyright (c) 2009-2024, Eric Bezault and others"
8+
copyright: "Copyright (c) 2009-2026, Eric Bezault and others"
99
license: "MIT License"
1010

1111
class ET_EXTENDED_ATTRIBUTE
@@ -32,7 +32,7 @@ inherit
3232

3333
ET_INTERNAL_FEATURE
3434
undefine
35-
reset,
35+
reset_after_features_flattened,
3636
is_attribute,
3737
is_transient_attribute,
3838
is_stable_attribute,

library/tools/src/eiffel/ast/feature/et_external_function.e

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,12 @@ inherit
2222

2323
ET_EXTERNAL_ROUTINE
2424
undefine
25-
reset, type, is_prefixable, is_infixable,
26-
is_bracketable, is_function
25+
reset_after_features_flattened,
26+
type,
27+
is_prefixable,
28+
is_infixable,
29+
is_bracketable,
30+
is_function
2731
end
2832

2933
create

library/tools/src/eiffel/ast/feature/et_function.e

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@ inherit
2929

3030
ET_ROUTINE
3131
undefine
32-
reset, type, is_prefixable, is_infixable, is_bracketable
32+
reset_after_features_flattened,
33+
type,
34+
is_prefixable,
35+
is_infixable,
36+
is_bracketable
3337
redefine
3438
is_function
3539
end

library/tools/src/eiffel/ast/feature/et_internal_function.e

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"Eiffel internal (do or once) functions"
66

77
library: "Gobo Eiffel Tools Library"
8-
copyright: "Copyright (c) 1999-2002, Eric Bezault and others"
8+
copyright: "Copyright (c) 1999-2026, Eric Bezault and others"
99
license: "MIT License"
1010

1111
deferred class ET_INTERNAL_FUNCTION
@@ -19,8 +19,12 @@ inherit
1919

2020
ET_INTERNAL_ROUTINE
2121
undefine
22-
reset, type, is_prefixable, is_infixable,
23-
is_bracketable, is_function
22+
reset_after_features_flattened,
23+
type,
24+
is_prefixable,
25+
is_infixable,
26+
is_bracketable,
27+
is_function
2428
end
2529

2630
end

library/tools/src/eiffel/ast/feature/et_once_function.e

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"Eiffel once-functions"
66

77
library: "Gobo Eiffel Tools Library"
8-
copyright: "Copyright (c) 1999-2024, Eric Bezault and others"
8+
copyright: "Copyright (c) 1999-2026, Eric Bezault and others"
99
license: "MIT License"
1010

1111
class ET_ONCE_FUNCTION
@@ -22,8 +22,12 @@ inherit
2222

2323
ET_ONCE_ROUTINE
2424
undefine
25-
reset, type, is_prefixable, is_infixable,
26-
is_bracketable, is_function
25+
reset_after_features_flattened,
26+
type,
27+
is_prefixable,
28+
is_infixable,
29+
is_bracketable,
30+
is_function
2731
end
2832

2933
create

0 commit comments

Comments
 (0)