-
Notifications
You must be signed in to change notification settings - Fork 34
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
Add support for wildcard in the upper bound to improve Java interop #1386
Comments
@RossTate thoughts? Are wildcards in upper bounds OK? |
Oops, I just saw this. As I mentioned in the thread, that's not necessary to solve the problem. You probably just have a glitch in importing the wildcard in the inheritance clause. Here are the reductions that prove that the
|
To clarify, this following code does not compile with Ceylon IDE 1.1.1.v20150721-1337-Final. The imports from Java are correct and verified. Can you provide more specifics on how to get this working in the ChronoLocalDateTime at least? Or are you saying this doesn't work b/c of a separate bug within the import handling? import java.lang {Comparable,Double}
import java.time {LocalDateTime, LocalDate}
import java.time.chrono {ChronoLocalDateTime}
A<T> bar<T>(A<T> t) given T satisfies Comparable<T> => t;
void test() {
bar<Double>(A<Double>());
bar<LocalDateTime>(A<LocalDateTime>());
bar<ChronoLocalDateTime<LocalDate>>(A<ChronoLocalDateTime<LocalDate>>());
} |
Correct. And the feature proposed hear would not solve any of the problems. So I think this would be better classified as an issue for the compiler rather than for the spec. However, I'd first like @gavinking to chime in to confirm that my reasoning is sound. Also, the |
Actually, |
Where do you get that from? The declaration is: public interface ChronoLocalDateTime<D extends ChronoLocalDate>
extends Temporal, TemporalAdjuster, Comparable<ChronoLocalDateTime<?>> { ... } i.e. |
I'm also not seeing this one.
This is sound, but not quite for the stated reason: we treat |
You're misreading my proofs because I wrote them backwords. Read them as "in order to prove step 1, we must prove step 2, which then requires step 3, which then holds or doesn't hole due to step 4". The parentheticals indicate why the prior step reduces to that step. Also, since it sounds like you're not inferring that Java's Try that. If that works, then the problem was that @pusolito gave |
Right, precisely! That's exactly what I wrote in the issue description! The problem is that right now we never allow a wildcard instantiation of a supertype, not even for type parameters (i.e. upper bounds). So I can't write that. |
Ohh, sorry, I didn't realize you were calling |
@RossTate cool, thanks. |
Ceylon doesn't support wildcard in the upper bound which prevents interacts with Java like the following:
From @gavinking:
The text was updated successfully, but these errors were encountered: