Skip to content

Commit 98bc504

Browse files
committed
exppp: redeclared attrs in URs shouldn't have qualifiers
1 parent 5fa2ebb commit 98bc504

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

src/express/resolve.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1313,7 +1313,7 @@ static void ENTITYresolve_subtypes( Entity e ) {
13131313
* where "entity" represents a supertype (only, I believe)
13141314
*/
13151315
void ENTITYresolve_uniques( Entity e ) {
1316-
Variable attr;
1316+
Variable attr, attr2 = 0;
13171317
int failed = 0;
13181318
LISTdo( e->u.entity->unique, unique, Linked_List ) {
13191319
int i = 0;
@@ -1337,9 +1337,19 @@ void ENTITYresolve_uniques( Entity e ) {
13371337
( expr->e.op1->e.op_code == OP_GROUP ) &&
13381338
( expr->e.op1->e.op1->type == Type_Self ) ) {
13391339
attr = ENTITYresolve_attr_ref( e, &( expr->e.op1->e.op2->symbol ), &( expr->e.op2->symbol ) );
1340+
attr2 = ENTITYresolve_attr_ref( e, 0, &( expr->e.op2->symbol ) );
13401341
} else {
13411342
attr = ENTITYresolve_attr_ref( e, 0, &( expr->symbol ) );
13421343
}
1344+
if( ( attr2 ) && ( attr != attr2 ) && ( ENTITYdeclares_variable( e, attr2 ) ) ) {
1345+
/* 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 );
1352+
}
13431353
if( !attr ) {
13441354
/* ERRORreport_with_symbol(ERROR_unknown_attr_in_entity,*/
13451355
/* aref->attribute, aref->attribute->name,*/

0 commit comments

Comments
 (0)