Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect shadowing of to (and other infix) operators #2

Open
kiiadi opened this issue Oct 2, 2018 · 0 comments
Open

Detect shadowing of to (and other infix) operators #2

kiiadi opened this issue Oct 2, 2018 · 0 comments
Labels
checkstyle enhancement New feature or request

Comments

@kiiadi
Copy link
Owner

kiiadi commented Oct 2, 2018

Example code that accidentally calls the wrong method

interface Person {
    val displayName: String
}

object Hello {
    fun to(p: Person) {
        println("Hello ${p.displayName}!!")
    }
}

object Student {
    val displayName = "Student"
}

fun main(args: Array<String>) {
    //Should print "Hello Student!!"    
    Hello.to(Student)
}

This actually calls kotlin.to in the standard library.

@kiiadi kiiadi added enhancement New feature or request checkstyle labels Oct 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
checkstyle enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant