These are chat archives for ceylon/ceylon-ide-eclipse

24th
Mar 2016
Bastien Jansen
@bjansen
Mar 24 2016 10:09
interesting
looks like it's a lot of work, if they predict a first beta for next year
Roland Tepp
@luolong
Mar 24 2016 10:10
No, this is from 2013.
Bastien Jansen
@bjansen
Mar 24 2016 10:10
oh right
october 2014
Roland Tepp
@luolong
Mar 24 2016 10:10
It seems to be released/in production
Gavin King
@gavinking
Mar 24 2016 17:03
ceylon/ceylon-ide-eclipse#1751
Bastien Jansen
@bjansen
Mar 24 2016 17:14
about the first exception:
the code is basically this
    shared actual ObjectArray<IContextInformation> blah() {
       ...
            return ObjectArray(0);
    }
Gavin King
@gavinking
Mar 24 2016 17:15
OK
that looks incorrect
Bastien Jansen
@bjansen
Mar 24 2016 17:15
I didn't specify type arguments, and the typechecker didn't complain
Gavin King
@gavinking
Mar 24 2016 17:15
it should not even type check!
very strange
oh i see
you returned an ObjectArray<Nothing> I guess
Bastien Jansen
@bjansen
Mar 24 2016 17:15
hover says ObjectArray<out Nothing>
yes
Gavin King
@gavinking
Mar 24 2016 17:15
is ObjectArray covariant?
<out Nothing> wtf?!
oh i see
i get it
it’s covariant
Bastien Jansen
@bjansen
Mar 24 2016 17:16
@TypeParameters(@TypeParameter(value="T", 
                variance=Variance.OUT,
                satisfies="ceylon.language::Object"))
public final class ObjectArray<T> implements ReifiedType {
Tom Bentley
@tombentley
Mar 24 2016 17:16
Yes, like Java's array types are covariant
Bastien Jansen
@bjansen
Mar 24 2016 17:16
it's a java class with ceylon annotations
Gavin King
@gavinking
Mar 24 2016 17:17
so it’s a compiler bug then?
Bastien Jansen
@bjansen
Mar 24 2016 17:17
don't know
I suppose return ObjectArray<IContextInformation>(0); will fix the problem
Gavin King
@gavinking
Mar 24 2016 17:17
what is the generated source? new Object[0]?
nononono @bjansen this is a Java array instantiation
look at the generated source
I assume that it should be new IContextInformation[0]
oh wait
it’s because Nothing erases to Object
oh fuck
ooops
@tombentley that’s a real hole
we never thought of that
when we made ObjectArray covariant
ooops
Tom Bentley
@tombentley
Mar 24 2016 17:19
Mmm. Yeah.
Gavin King
@gavinking
Mar 24 2016 17:19
ouch
Tom Bentley
@tombentley
Mar 24 2016 17:20
But I don't see what we can do about it.
Gavin King
@gavinking
Mar 24 2016 17:20
i think we need to make it a bug to instantiate ObjectArray with union/intersection/nothing typ args
we could have made ObjectArray invariant
Tom Bentley
@tombentley
Mar 24 2016 17:20
Well we needed something we could erase to a Java []
Gavin King
@gavinking
Mar 24 2016 17:20
i think i remember arguing in favor of that at the time, and I lost the argument
Bastien Jansen
@bjansen
Mar 24 2016 17:21
the other exception should be fixed now
Tom Bentley
@tombentley
Mar 24 2016 17:21
I guess we can put in a typetest to throw with Nothing.
Gavin King
@gavinking
Mar 24 2016 17:21
we need to prohibit instantiation of ObjectArray<Nothing>, that is clear
Tom Bentley
@tombentley
Mar 24 2016 17:22
What's wrong with union and intersection types though
Gavin King
@gavinking
Mar 24 2016 17:22
or do it in the typechecker
@tombentley same thing: it’s an ObjectArray<Object> underneath
i mean an Object[] underneath
even if the unioned types or intersected types have a common supertype
Tom Bentley
@tombentley
Mar 24 2016 17:22
Urgh. Yes, I suppose.
Gavin King
@gavinking
Mar 24 2016 17:23
@bjansen for now just add in the explicit type arguments
Tom Bentley
@tombentley
Mar 24 2016 17:23
Thing is Java arrays are covariant (therefore not typesafe), and this thing is supposed to be a Java array.
Bastien Jansen
@bjansen
Mar 24 2016 17:23
ok
Gavin King
@gavinking
Mar 24 2016 17:23
we had this argument at length when we implemented this
Tom Bentley
@tombentley
Mar 24 2016 17:23
Yes, I know
Gavin King
@gavinking
Mar 24 2016 17:23
you will recall I argued for invariance because arrays are actually invariant
Tom Bentley
@tombentley
Mar 24 2016 17:24
Well it was more you and @FroMage
Gavin King
@gavinking
Mar 24 2016 17:24
but I didn’t think of this
or perhaps we thought of it and decided it wasn’t such a huge big deal