Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

null == value expression causes compilation error. #854

Closed
gallandarakhneorg opened this issue Sep 13, 2018 · 1 comment
Closed

null == value expression causes compilation error. #854

gallandarakhneorg opened this issue Sep 13, 2018 · 1 comment

Comments

@gallandarakhneorg
Copy link
Member

gallandarakhneorg commented Sep 13, 2018

I have defined several extension methods (which are implicitly imported):

def boolean operator_equals(AtomicLong left, int right) {}
def boolean operator_equals(AtomicLong left, short right) {}
def boolean operator_equals(AtomicLong left, long right) {}
def boolean operator_equals(AtomicLong left, float right) {}
def boolean operator_equals(AtomicLong left, double right) {}
def boolean operator_equals(AtomicLong left, byte right) {}
def boolean operator_equals(AtomicLong left, Number right) {}
def boolean operator_equals(AtomicInteger left, int right) {}
def boolean operator_equals(AtomicInteger left, short right) {}
def boolean operator_equals(AtomicInteger left, long right) {}
def boolean operator_equals(AtomicInteger left, float right) {}
def boolean operator_equals(AtomicInteger left, double right) {}
def boolean operator_equals(AtomicInteger left, byte right) {}
def boolean operator_equals(AtomicInteger left, Number right) {}

The following lines are compiled without error:

def void fct(AtomicInteger value) {
  if (value == null) {
  }
}

But, the following lines cause a compilation error (ambiguous feature call):

def void fct(AtomicInteger value) {
  if (null == value) {
  }
}

As you could see, the operands of the == operator are switched.
Semantically, both definitions are equivalent.
Both should compile without error.

@gallandarakhneorg
Copy link
Member Author

This issue should be fixed within Xbase. See Issue 300 for Xbase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant