Fixed
Status Update
Comments
uc...@google.com <uc...@google.com> #2
Reproduced in
Android Studio 3.1 Beta 4
Build #AI-173.4615496, built on February 21, 2018
JRE: 1.8.0_152-release-1024-b01 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 4.9.0-5-amd64
Android Studio 3.1 Beta 4
Build #AI-173.4615496, built on February 21, 2018
JRE: 1.8.0_152-release-1024-b01 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 4.9.0-5-amd64
tn...@google.com <tn...@google.com> #3
Fixed for 3.2 alpha 6 by Change-Id: I33a69b3b48610b1847b93475f0b20bb0c3008f09 . Thanks for the report!
ha...@gmail.com <ha...@gmail.com> #4
Will this fix also appear in 3.1? These false positives break builds on CI, preventing an upgrade.
tn...@google.com <tn...@google.com> #5
Yes, I've just applied it to 3.1 as well.
lo...@gmail.com <lo...@gmail.com> #6
Awesome news! Thanks again!
Description
fun lambda(): () -> Single<Int> = {
if (true) {
Single.just(3)
} else {
Single.just(5)
}
}
Removing the brackets from the if statement would prevent the issue:
fun lambda(): () -> Single<Int> = {
if (true) Single.just(3) else Single.just(5)
}
What I found really interesting is that I wasn't able to reproduce the issue with another parameterized type like List
fun lambda(): () -> List<Int> = {
if (true) {
listOf(2)
} else {
listOf(5)
}
}