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

The code in the "Unsoundness" subsection of the "Explicit Nulls" page doesn't compile #7881

Closed
ShapelessCat opened this issue Dec 31, 2019 · 1 comment · Fixed by #8481
Closed
Assignees

Comments

@ShapelessCat
Copy link
Contributor

The provided code doesn't compile when there is a -Yexplicit-nulls flag.
With explicit nulls, we can't compile code like stringValue == null, which is mentioned in the subsection "Equality" that just after the "Unsoundness" subsection.

I think this piece of code can be corrected and simplified as

class C {
  val f: String = foo(f)
  def foo(f2: String): String = f2

val c = new C()
// c.f is null

@nicolasstucki
Copy link
Contributor

This should be caught by #7789

liufengyun added a commit to dotty-staging/dotty that referenced this issue Mar 9, 2020
nicolasstucki added a commit that referenced this issue Mar 9, 2020
Fix #7881: fix example and add link to -Ycheck-init
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants