Array underlying backing array uses java.lang.Object[] for optional types #402

Closed
FroMage opened this Issue Jan 28, 2014 · 10 comments

Comments

Projects
None yet
3 participants
Owner

FroMage commented Jan 28, 2014

Which means the following doesn't pass anymore:

test void compilerBug640(){
    value x = Array<Accept?> { Accept(), Accept(), Accept() };
    Accept().accepts(javaObjectArray(x));
}
public class Accept {
    public void longs(long[] args) { }
    public void strings(String[] args) { }
    public void accepts(Accept[] args) { }
}

@ghost ghost assigned gavinking Jan 28, 2014

Owner

gavinking commented Jan 28, 2014

This makes me realize that the mechanism we use to determine if we have an array of a "primitive" type is actually quite broken. If I have an Array<Integer|Integer>, it will not realize that this is really an Array<Integer>. So we're going to need to fully materialize the reified type when instantiating arrays.

Owner

gavinking commented Jan 28, 2014

So where do I get a RuntimeModuleManager from, in order to do that?

Owner

gavinking commented Jan 29, 2014

So we're going to need to fully materialize the reified type when instantiating arrays.

Looks like I've figured out a solution that doesn't require this.

gavinking added a commit that referenced this issue Jan 29, 2014

gavinking added a commit that referenced this issue Jan 29, 2014

Owner

gavinking commented Jan 29, 2014

We need a lot more tests for this stuff!

Owner

gavinking commented Jan 29, 2014

We're also going to need special cases for Identifiable, Basic, and Anything.

Owner

gavinking commented Jan 29, 2014

So there was a whole wide family of bugs here, of which this was just one. I think I've got most of the cases handled now, though I would not be remotely surprised if there's some I've missed.

Basically, we need waaay more tests here, since the tests that exist don't begin to cover all the special cases that exist:

  • union and intersection types
  • optional types vs definite types
  • erased types
  • Java arrays
Owner

gavinking commented Jun 6, 2014

Closing.

@gavinking gavinking closed this Jun 6, 2014

Member

tombentley commented Jun 9, 2014

Why've you closed this when it looks like we still need more tests?

Owner

gavinking commented Jun 9, 2014

@tombentley I don't know what tests are required.

Member

tombentley commented Jun 9, 2014

Well, you wrote a bulleted list of types we ought to be testing, let's at least make sure we have tests for those.

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