WurstScript icon indicating copy to clipboard operation
WurstScript copied to clipboard

Unable to create constructor for a derived generic class

Open ssl024 opened this issue 6 years ago • 1 comments

I am trying to extend LLIterator<T> found in LinkedList.wurst and it does not seem to accept what looks like a well-formed constructor.

package ListIterator

import LinkedList

public class ListIterator<T> extends LLIterator<T>
    construct(LinkedList<T> parent)
        super(parent)

Error: Incorrect call to super constructor: Expected LinkedList<T> as parameter 1 but found LinkedList<T> Wurst

ssl024 avatar Jun 29 '19 04:06 ssl024

Another example:

// ============================================================================
public abstract class BaseNode<T>
  
  private BaseNode<T> _parent
  private T _data

  // --------------------------------------------------------------------------
  construct (BaseNode<T> parent, T data)
    _parent = parent
    _data = data

// ============================================================================
public class MyCustomData
  int foobar

// ============================================================================
public class MyCustomNode extends BaseNode<MyCustomData>

  // --------------------------------------------------------------------------
  construct (MyCustomNode parent, MyCustomData data)
    super(parent, data)
Incorrect call to super constructor: Expected BaseNode<T> as parameter 1 but found MyCustomNode
Incorrect call to super constructor: Expected T as parameter 2 but found MyCustomData

jlfarris91 avatar Nov 09 '19 22:11 jlfarris91