Check platform<->impl declaration compatibility

For each platform declaration, there must be at least one impl declaration in
the module with the compatible signature; similarly, for each impl declaration,
there must be at least one platform declaration with the compatible signature.

Note that currently the presence of the 'impl' modifier is not checked yet.

Also, the sad fact is that if you have platform and impl declarations which are
not compatible, you get two errors: on the platform delcaration and on the impl
declaration. This needs to be addressed as well
This commit is contained in:
Alexander Udalov
2016-11-21 11:29:02 +03:00
parent ad59d5a1c8
commit 8d3f6f1ce7
29 changed files with 1217 additions and 39 deletions
@@ -0,0 +1,13 @@
platform fun <T> f1(): T
platform fun <T> f2(t: T)
platform fun <K : Enum<K>, V : MutableList<out K>> f3(v: Map<V, Enum<in K>>, w: Comparable<*>)
platform fun <T: Comparable<T>> Array<out T>.sort(): Unit
platform class C1<A>
platform class C2<B : C2<B>>
platform class C3<D, E : MutableList<in D>>
platform abstract class AbstractList<F> : MutableList<F>
@@ -0,0 +1,15 @@
impl fun <T> f1(): T = throw AssertionError()
impl fun <T> f2(t: T) {}
impl fun <K : Enum<K>, V : MutableList<out K>> f3(v: Map<V, Enum<in K>>, w: Comparable<*>) {}
impl fun <T: Comparable<T>> Array<out T>.sort(): Unit {
java.util.Arrays.sort(this)
}
impl class C1<A>
impl class C2<B : C2<B>>
impl class C3<D, E : MutableList<in D>>
impl abstract class AbstractList<F> : MutableList<F>, java.io.Serializable
@@ -0,0 +1,8 @@
-- Common --
Exit code: OK
Output:
-- JVM --
Exit code: OK
Output: