btilbrook-nextfaze
05/11/2018, 12:02 AMclass TestNullableProblem {
var foo: String? = "a"
var bar: String? = null
@Test fun `does not compile`() {
foo = null
// Fails to compile due to overload resolution ambiguity.
assertSomething(foo)
}
@Test fun `compiles 1`() {
// Why does this compile? bar is definitely null, so we'd expect the same overload ambiguity error as before.
assertSomething(bar)
}
@Test fun `compiles 2`() {
foo = "b"
assertSomething(foo)
}
@Test fun `compiles 3`() {
assertSomething(foo)
}
private fun assertSomething(v: String?): Unit = TODO()
private fun assertSomething(v: Int?): Unit = TODO()
}