New Issue: Support operator methods and inheritance

17097, “lydia-duncan”, “Support operator methods and inheritance”, “2021-02-05T19:11:32Z”

Summary of Problem

Got initial implementation of operator methods off the ground, but inheritance is slightly more tricky. Current behavior is a bunch of messages about coercion. Shouldn’t be too difficult to fix, but I didn’t want to remove the test I’d already committed.

Steps to Reproduce

Source Code:

class Parent {
  var x: int;

  operator <(lhs: Parent, rhs: Parent) {
    return lhs.x < rhs.x;

class Child: Parent {
  var y: bool;

var c1 = new Parent(2);
var c2 = new Child(3, false);
writeln(c1 < c2);
writeln(c2 < c1);
var c3 = new Child(4, true);
writeln(c2 < c3);
writeln(c3 < c2);

Compile command:
chpl foo.chpl

Associated Future Test(s):
test/functions/operatorOverloads/operatorMethods/inheritance.chpl #TBD

Configuration Information

  • Output of chpl --version: chapel 1.24 (pre-release)