public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Ada] Revamp type resolution for comparison and equality operators
@ 2022-05-09  9:30 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2022-05-09  9:30 UTC (permalink / raw)
  To: gcc-patches; +Cc: Eric Botcazou

[-- Attachment #1: Type: text/plain, Size: 3392 bytes --]

The main goal was to make it symmetrical, but this also moves error handling
entirely to the second phase of type resolution.

Tested on x86_64-pc-linux-gnu, committed on trunk

gcc/ada/

	* einfo.ads (Access Kinds): Reorder and beef up.
	* sem.adb (Analyze): Call Analyze_Comparison_Equality_Op for all
	comparison and equality operators.
	* sem_ch4.ads (Analyze_Comparison_Op): Delete.
	(Analyze_Equality_Op): Likewise.
	(Analyze_Comparison_Equality_Op): Declare.
	(Ambiguous_Operands): Likewise.
	* sem_ch4.adb (Ambiguous_Operands): Remove declaration.
	(Defined_In_Scope): Delete.
	(Find_Comparison_Types): Merge into...
	(Find_Equality_Types): Merge into...
	(Find_Comparison_Equality_Types): ...this.  Make fully symmetrical.
	(Analyze_Arithmetic_Op): Minor consistency tweaks.
	(Analyze_Comparison_Op): Merge into...
	(Analyze_Equality_Op): Merge into...
	(Analyze_Comparison_Equality_Op): ...this.  Make fully symmetrical.
	(Analyze_Logical_Op): Minor consistency tweaks.
	(Analyze_Membership_Op): Make fully symmetrical.
	(Analyze_One_Call): Minor comment tweak.
	(Analyze_Operator_Call): Call Find_Comparison_Equality_Types.
	(Analyze_User_Defined_Binary_Op): Make fully symmetrical.
	(Check_Arithmetic_Pair.Specific_Type): Delete.
	(Diagnose_Call): Add special handling for "+" operator.
	(Operator_Check): Call Analyze_Comparison_Equality_Op.
	* sem_ch8.adb (Has_Implicit_Operator): Add Is_Type guard for boolean
	operators, use Valid_Comparison_Arg and Valid_Equality_Arg for resp.
	comparison and equality operators.
	* sem_res.adb (Check_For_Visible_Operator): Call Is_Visible_Operator
	(Make_Call_Into_Operator): Use Preserve_Comes_From_Source.
	(Resolve_Actuals): Deal specifically with Any_Type actuals for user-
	defined comparison and equality operators.
	(Resolve_Call): Minor tweaks.
	(Resolve_Comparison_Op): Tidy up and give error for ambiguity.
	(Resolve_Equality_Op): Likewise, as well as other errors.
	(Rewrite_Renamed_Operator): Simplify.
	* sem_type.ads (Is_Invisible_Operator): Delete.
	(Is_Visible_Operator): Declare.
	(Has_Compatible_Type): Remove For_Comparison parameter.
	(Specific_Type): Declare.
	(Valid_Equality_Arg): Likewise.
	* sem_type.adb (Specific_Type): Remove declaration.
	(Add_One_Interp): Call Is_Visible_Operator for the visibility test.
	(Remove_Conversions): Rename into...
	(Remove_Conversions_And_Abstract_Operations): ...this.  Do not apply
	numeric-type treatment to Any_Type.  Expand the special handling for
	abstract interpretations to second operand.  Remove obsolete code.
	(Disambiguate): Adjust to above renaming.  Tweak to hidden case and
	call Remove_Conversions_And_Abstract_Operations for operators too.
	(Entity_Matches_Spec): Minor tweak.
	(Find_Unique_Type): Simplify and deal with user-defined literals.
	(Has_Compatible_Type): Remove For_Comparison parameter and adjust.
	Call the Is_User_Defined_Literal predicate and remove call to
	the Is_Invisible_Operator predicate.
	(Is_Invisible_Operator): Delete.
	(Is_Visible_Operator): New function.
	(Operator_Matches_Spec): Use Valid_Equality_Arg predicate.
	(Specific_Type): Tidy up, make fully symmetrical and deal with
	private views the same way as Covers.
	(Valid_Comparison_Arg): Return true for Any_Composite/Any_String.
	(Valid_Equality_Arg): New function.
	* sem_util.ads (Is_User_Defined_Literal): Declare.
	* sem_util.adb (Is_User_Defined_Literal): New function.

[-- Attachment #2: patch.diff.gz --]
[-- Type: application/gzip, Size: 24750 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-05-09  9:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-09  9:30 [Ada] Revamp type resolution for comparison and equality operators Pierre-Marie de Rodat

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).