Hello, not sure if this is the right channel to as...
# compiler
m
Hello, not sure if this is the right channel to ask, but I am wondering why is adding an
override
keyword to a method that isn't actually overriding anything not a compile error? In IntelliJ, it results in a red error underline and an "overrides nothing" message, but it compiles fine. I would have expected it to be a compile error, but it isn't.
d
It is a compilation error, actually:
Copy code
class Some {
    // reports "'foo' overrides nothing."
    override fun foo(): String = "OK"
}

fun main() {
    println(Some().foo())
}
https://pl.kotl.in/kPz_Udohl If you have an example where it isn't, please report it to youtrack, it's a bug.
m
Oh interesting, it isn't for me. I will try to make a minimal example and report.