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

Issue 5416 & 5889 - typeof(null) should have a type of its own #476

Merged
merged 2 commits into from
Nov 25, 2011

Conversation

9rnsr
Copy link
Contributor

@9rnsr 9rnsr commented Oct 27, 2011

Issue 5416 - null should have a type of its own
Issue 5899 - auto-return function cannot match 'null' with reference type.

typeof(null) should have the own type, that is implicitly convertible to any reference types.
In binary level, typeof(null) is treated as void*

I think this is also useful for NonNull!T, because we can reject NonNull!T p = null; statically.


void TypeNull::toCBuffer(OutBuffer *buf, Identifier *ident, HdrGenState *hgs)
{
buf->writestring("null_t");
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this should be
buf->writestring("typeof(null)");

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's better.

WalterBright added a commit that referenced this pull request Nov 25, 2011
Issue 5416 & 5889 - typeof(null) should have a type of its own
@WalterBright WalterBright merged commit 31a3e40 into dlang:master Nov 25, 2011
braddr pushed a commit to braddr/dmd that referenced this pull request Oct 22, 2012
Modified moduleName trait to only include the package name if it is valid
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