Skip to content

Broken proprty inits in Right-Associative (Unary) Operators #120

@StephanErb

Description

@StephanErb

Steps to reproduce: Make the minus operator in ExpressionWithSynthesizedAttributes.tcs right associative and then run the TestOperatorParsingScenarios tests.

The actual problem is within the generated parsers:

public final void setOclRef(Object object, String propertyName, String keyName, Object keyValue, String query,
        boolean optional, String propInitURI, ModelUpdaterRegistry modelUpdaterRegistry) {

    ANTLR3LocationToken lastToken = (ANTLR3LocationToken) input.LT(-1);
    <snip> 
    ...
}

SetOCLRef is called within ret=exp.... But at this point in time the minus token has not yet been parsed. input.LT(-1) thus returns the wrong token. This leads to problems in any code relying on the token value (e.g., ReferenceHandlerImpl#resolveRemainingReferences)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions