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

Procedure erroneously interpreted as @Block if return type constructor has args #179

Open
dwtj opened this issue Mar 8, 2017 · 0 comments
Labels
Milestone

Comments

@dwtj
Copy link
Collaborator

dwtj commented Mar 8, 2017

The following type should be duckable.

package pi;

public class Result { // a duckable number type
  private int val;
  public Result(int val) {
    this.val = val;
  }
  public int getValue() {
    return val;
  }
}

However, if we return this type from some procedure

package pi;
@Capsule
class WorkerCore {
  Result calculate(int numIterations)  {
    int circleCount = 0;
    // ...
    return new Result(circleCount);
  }
}

then calculate will be inferred to be @block. (We can see this in the auto-generated pi.Worker interface.)

I suspect that this bug arises from the fact that this constructor takes an argument. For example, if we change the definition of Result to the following, the procedure is (correctly) inferred to be @duck.

package pi;

public class Result { // a duckable number type
  private int val;
  public int getValue() {
    return val;
  }
  public void setValue(int val) {
      this.val = val;
  }
}
@dwtj dwtj added the bug label Mar 8, 2017
@dwtj dwtj added this to the v0.2.3 milestone Mar 29, 2017
@jlmaddox jlmaddox modified the milestones: v0.2.3, v0.3 Jan 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants