File tree 3 files changed +6
-1
lines changed
compiler/test/dotty/tools/dotc
3 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -182,6 +182,7 @@ class CompilationTests extends ParallelTesting {
182
182
compileFile(" ../tests/neg/tailcall/tailrec.scala" , defaultOptions) +
183
183
compileFile(" ../tests/neg/tailcall/tailrec-2.scala" , defaultOptions) +
184
184
compileFile(" ../tests/neg/tailcall/tailrec-3.scala" , defaultOptions) +
185
+ compileFile(" ../tests/neg/i3246.scala" , scala2Mode) +
185
186
compileDir(" ../tests/neg/typedIdents" , defaultOptions)
186
187
}.checkExpectedErrors()
187
188
Original file line number Diff line number Diff line change 1
1
class Test {
2
2
def foo (x : Int ) = 1
3
- val bar : () => Int = foo _
3
+ val bar : () => Int = foo _ // error: type mismatch
4
4
}
Original file line number Diff line number Diff line change @@ -4,4 +4,8 @@ class Test {
4
4
def baz = 1
5
5
def bam : () => Int = baz _
6
6
def ban : () => Int = 1 _
7
+
8
+ def titi (fun : () => Unit ) = ???
9
+ def toto (fun : => Int ) = titi(fun _)
10
+ titi(1 _) // rejected by scalac
7
11
}
You can’t perform that action at this time.
0 commit comments