Skip to content

Check Java classes are not used as objects #1201

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

Merged
merged 1 commit into from
Apr 8, 2016
Merged

Check Java classes are not used as objects #1201

merged 1 commit into from
Apr 8, 2016

Conversation

liufengyun
Copy link
Contributor

Following code should not pass Ycheck:

import java.lang.Math

val myMath: Math.type = Math
myMath.sqrt(3.0)
id(myMath)

Fix #972. Review @DarkDimius .

assertIdentNotJavaClass(expr)
cases.foreach(caseDef => assertIdentNotJavaClass(caseDef.body))
assertIdentNotJavaClass(finalizer)
case untpd.Throw(expr) =>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to handle untyped trees here.
They would never reach Ycheck.

Following code should not pass Ycheck:

    import java.lang.Math

    val myMath: Math.type = Math
    myMath.sqrt(3.0)
    id(myMath)
@DarkDimius
Copy link
Contributor

LGTM

@DarkDimius DarkDimius merged commit 1c56d8c into scala:master Apr 8, 2016
@liufengyun liufengyun deleted the i972 branch April 8, 2016 11:57
@liufengyun
Copy link
Contributor Author

Thanks @DarkDimius .

When you have time, could you please add some description to the benchmark infrastructure task #1210 ? That would help a lot for me to get started. Thanks a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants