title: Class method accepting derived classes in Chapel
body: <p>Consider the following code where I wish to store instances of a class (Class2 here) and its derived classes (Class3 here) in an array residing in another class (Class1 here). As notated, the compiler is not happy with the final line. What am I doing wrong?</p>
  
  <pre><code>class Class2 {
      var y : int;
  }
  
  class Class3 : Class2 {
      var z : int;
  }
  
  class Class1 {
      var count : int;
      var x : [0..10] owned Class2?;
  
      proc add(ref a : Class2) {
          x[count] = a;
          count += 1;
      }
  }
  
  var C1 = new owned Class1();
  var C2 = new owned Class2();
  var C3 = new owned Class3();
  
  C1.add(C2); // OK
  C1.add(C3); // Compiler not happy
  </code></pre>
  
  <p>Compiler output:</p>
  
  <pre><code>test2.chpl:25: error: unresolved call 'owned Class1.add(owned Class3)'
  test2.chpl:14: note: this candidate did not match: Class1.add(ref a: Class2)
  test2.chpl:25: note: because call actual argument #1 with type owned Class3
  test2.chpl:14: note: is passed to formal 'ref a: owned Class2'
  $CHPL_HOME/modules/internal/Atomics.chpl:557: note: candidates are: AtomicT.add(value: T, param order: memoryOrder = memoryOrder.seqCst)
  $CHPL_HOME/modules/internal/NetworkAtomics.chpl:280: note:                 RAtomicT.add(value: T, param order: memoryOrder = memoryOrder.seqCst)
  note: and 4 other candidates, use --print-all-candidates to see them
  </code></pre>