Skip to content

Commit da42229

Browse files
committed
Add InferExpectedTypeSuite.map and fixup others
1 parent e896db2 commit da42229

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

Diff for: presentation-compiler/test/dotty/tools/pc/tests/InferExpectedTypeSuite.scala

+12-3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class InferExpectedTypeSuite extends BasePCSuite:
2626
EmptyCancelToken
2727
)
2828
presentationCompiler.asInstanceOf[ScalaPresentationCompiler].inferExpectedType(offsetParams).get().asScala match {
29-
case Some(value) => assertNoDiff(value, expectedType)
29+
case Some(value) => assertNoDiff(expectedType, value)
3030
case None => fail("Empty result.")
3131
}
3232

@@ -232,6 +232,15 @@ class InferExpectedTypeSuite extends BasePCSuite:
232232
|""".stripMargin
233233
)
234234

235+
@Ignore("Generic functions are not handled correctly.")
236+
@Test def map =
237+
check(
238+
"""|val _ : List[Int] = List().map(_ => @@)
239+
|""".stripMargin,
240+
"""|Int
241+
|""".stripMargin
242+
)
243+
235244
@Ignore("Generic functions are not handled correctly.")
236245
@Test def `for-comprehension` =
237246
check(
@@ -260,7 +269,7 @@ class InferExpectedTypeSuite extends BasePCSuite:
260269
@Test def `bounds-1` =
261270
check(
262271
"""|trait Foo
263-
|def foo[T <: Foo](a: Foo): Boolean = ???
272+
|def foo[T <: Foo](a: T): Boolean = ???
264273
|val _ = foo(@@)
265274
|""".stripMargin,
266275
"""|<: Foo
@@ -271,7 +280,7 @@ class InferExpectedTypeSuite extends BasePCSuite:
271280
@Test def `bounds-2` =
272281
check(
273282
"""|trait Foo
274-
|def foo[T :> Foo](a: Foo): Boolean = ???
283+
|def foo[T >: Foo](a: T): Boolean = ???
275284
|val _ = foo(@@)
276285
|""".stripMargin,
277286
"""|:> Foo

0 commit comments

Comments
 (0)