Skip to content

Fix subtyping of null and refined types. #276

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
Dec 13, 2014

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Dec 13, 2014

Review by @smarter

@odersky
Copy link
Contributor Author

odersky commented Dec 13, 2014

Closes #262

@smarter
Copy link
Member

smarter commented Dec 13, 2014

I'm a bit concerned that there's now three different definitions of what being nullable is depending on what method is used:

  • Type#isNotNull
  • SymDenotations#isNullableClass
  • isNullable in TypeComparer#fourthTry

Could this be simplified?

@odersky odersky merged commit 179b9cc into scala:master Dec 13, 2014
@odersky
Copy link
Contributor Author

odersky commented Dec 13, 2014

I don't think so.

Type#isNotNull: It's guaranteed to ne not null
isNullable, isNullableClass: null conforms to the type (or a type instance of the class).

The two are not the same.

E.g. an abstract type is not guaranteed to be null, but null does not conform to it.

@smarter
Copy link
Member

smarter commented Dec 13, 2014

OK, that sounds reasonable.

@allanrenucci allanrenucci deleted the fix/#262-null-subtyping branch December 14, 2017 19:21
tgodzik added a commit to tgodzik/scala3 that referenced this pull request Apr 29, 2025
Backport "Exclude synthetic this.m, Any.m from import lookup" to 3.3 LTS
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.

2 participants