Kotlin 1.8 이상에서 컴파일 오류를 발생시키는 when 브랜치의 모호한 논리 식을 보고합니다.


  fun Int.matches(strict: Boolean): Boolean = when (strict) {
      true -> this == 6
      this in (4..7) -> true // 모호합니다
      else -> false
  }

빠른 수정을 적용한 후:


  fun Int.matches(strict: Boolean): Boolean = when (strict) {
      true -> this == 6
      (this in (4..7)) -> true // 소괄호로 래핑되어 있습니다
      else -> false
  }

검사는 Kotlin 언어 수준 1.7부터 이용할 수 있습니다.