Added test for sam

This commit is contained in:
Mikhael Bogdanov
2013-12-02 13:06:22 +04:00
parent 712dcaac91
commit 59dbf75d80
2 changed files with 62 additions and 0 deletions
@@ -0,0 +1,57 @@
// FILE: Run.java
public interface Run {
public int run();
}
// FILE: Test.java
public class Test {
public void test(Run r) {
}
}
// FILE: test.kt
inline fun inlineFunWithInvoke(s: (p: Int) -> Unit, ext: Int.(p: Int) -> Unit) {
Test().test(){
s(11)
s.invoke(11)
s invoke 11
11.ext(11)
11 ext 11
<!USAGE_IS_NOT_INLINABLE, UNUSED_EXPRESSION!>s<!>
<!USAGE_IS_NOT_INLINABLE, UNUSED_EXPRESSION!>ext<!>
11
}
}
inline fun inlineFunWithInvokeNonInline(noinline s: (p: Int) -> Unit, ext: Int.(p: Int) -> Unit) {
Test().test(){
s(11)
s.invoke(11)
s invoke 11
11.ext(11)
11 ext 11
<!UNUSED_EXPRESSION!>s<!>
<!USAGE_IS_NOT_INLINABLE, UNUSED_EXPRESSION!>ext<!>
11
}
}
inline fun Function1<Int, Unit>.inlineExt() {
Test().test(){
invoke(11)
this.invoke(11)
this invoke 11
this(11)
<!USAGE_IS_NOT_INLINABLE!>this<!>
11
}
}
@@ -3832,6 +3832,11 @@ public class JetDiagnosticsTestGenerated extends AbstractDiagnosticsTestWithEage
doTest("compiler/testData/diagnostics/tests/inline/returns.kt");
}
@TestMetadata("sam.kt")
public void testSam() throws Exception {
doTest("compiler/testData/diagnostics/tests/inline/sam.kt");
}
@TestMetadata("typed.kt")
public void testTyped() throws Exception {
doTest("compiler/testData/diagnostics/tests/inline/typed.kt");