value c = Consumer<Inter1|Inter2>();
if (is Consumer<Inter1>() c) { // there should be a compile error
// well, it is a super type, it should not narrow
print("ok");
}
print("end");
firstly it compiles (if I replace Inter1 with String and Inter2 with Integer, it dont), but `Consumer<Inter1>` is a supertype of `Consumer<Inter1|Inter2>`, secondly at execution it does not print ok.
I was unable to find if this bug as been reported.
I also remark that type checker consider Producer<Inter1> & Producer<Inter2> equivalent to Producer<Inter1&Inter2> which is right (Ceylon does not permits satisfying multi times Producer) but does not correspond to the spec. And curiously it does not apply this equivalence in Invariant.
value c = Consumer<Inter1|Inter2>(); // here you instantiated a Consumer<Inter1|Inter2>
if (is Consumer<Inter1>() c) { // here you're testing for type Callable<Consumer<Inter1>,[]>
print("ok");
}
print("end");
So a '()' snuck in your 'is' test, turning it into a Callable type.
--
You received this message because you are subscribed to the Google Groups "ceylon-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceylon-dev+...@googlegroups.com.
To post to this group, send email to ceylo...@googlegroups.com.
Visit this group at http://groups.google.com/group/ceylon-dev.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceylon-dev/1edddf9f-6353-4605-a997-6346e56bf20a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.