@@ -105,6 +105,7 @@ static Error ERROR_overloaded_attribute;
105105static Error ERROR_redecl_no_such_attribute ;
106106static Error ERROR_redecl_no_such_supertype ;
107107static Error ERROR_missing_self ;
108+ static Error WARNING_unique_qual_redecl ;
108109
109110static Type self = 0 ; /**< always points to current value of SELF or 0 if none */
110111
@@ -221,12 +222,14 @@ void RESOLVEinitialize( void ) {
221222
222223 WARNING_case_skip_label = ERRORcreate ( "CASE label %s cannot be matched. Ignoring its statements." , SEVERITY_WARNING );
223224
225+ WARNING_unique_qual_redecl = ERRORcreate ( "Possibly unnecessary qualifiers on redeclared attr '%s' in a uniqueness rule of entity '%s'." , SEVERITY_WARNING );
224226
225227 ERRORcreate_warning ( "circular_subtype" , ERROR_subsuper_loop );
226228 ERRORcreate_warning ( "circular_select" , ERROR_select_loop );
227229 ERRORcreate_warning ( "entity_as_type" , ERROR_type_is_entity );
228230 ERRORcreate_warning ( "invariant_condition" , WARNING_fn_skip_branch );
229231 ERRORcreate_warning ( "invalid_case" , WARNING_case_skip_label );
232+ ERRORcreate_warning ( "unnecessary_qualifiers" , WARNING_unique_qual_redecl );
230233}
231234
232235/** Clean up the Fed-X second pass */
@@ -265,6 +268,7 @@ void RESOLVEcleanup( void ) {
265268 ERRORdestroy ( ERROR_missing_self );
266269 ERRORdestroy ( WARNING_case_skip_label );
267270 ERRORdestroy ( WARNING_fn_skip_branch );
271+ ERRORdestroy ( WARNING_unique_qual_redecl );
268272}
269273
270274/**
@@ -1343,12 +1347,8 @@ void ENTITYresolve_uniques( Entity e ) {
13431347 }
13441348 if ( ( attr2 ) && ( attr != attr2 ) && ( ENTITYdeclares_variable ( e , attr2 ) ) ) {
13451349 /* attr exists in type + supertype - it's a redeclaration.
1346- * in this case, eliminate qualifiers */
1347- reflink -> data = (Generic ) expr -> e .op2 ;
1348- EXP_destroy ( expr -> e .op1 -> e .op1 );
1349- EXP_destroy ( expr -> e .op1 -> e .op2 );
1350- EXP_destroy ( expr -> e .op1 );
1351- EXP_destroy ( expr );
1350+ * in this case, qualifiers are unnecessary; print a warning */
1351+ ERRORreport_with_symbol ( WARNING_unique_qual_redecl , & ( expr -> e .op2 -> symbol ), expr -> e .op2 -> symbol .name , e -> symbol .name );
13521352 }
13531353 if ( !attr ) {
13541354 /* ERRORreport_with_symbol(ERROR_unknown_attr_in_entity,*/
0 commit comments