Skip to content

Comments

[REG2.064] Issue 11614 - Error: this for _expand_field_0 needs to be type Tuple not type Foo#2897

Merged
MartinNowak merged 1 commit intodlang:masterfrom
9rnsr:fix11614
Nov 30, 2013
Merged

[REG2.064] Issue 11614 - Error: this for _expand_field_0 needs to be type Tuple not type Foo#2897
MartinNowak merged 1 commit intodlang:masterfrom
9rnsr:fix11614

Conversation

@9rnsr
Copy link
Contributor

@9rnsr 9rnsr commented Nov 29, 2013

https://d.puremagic.com/issues/show_bug.cgi?id=11614

Even if a variable has no valid context, it would be either:

  1. a part of compile time evaluated expression, which is used as unreal context.
    enum x = Type.fieldvar.sizeof;
    // It's legitimate expression so fieldvar is not evaluated
    // in runtime.
  2. or an invalid field access without valid 'this', in runtime evaluated expression.
    int y = Type.fieldvar;
    // It's invalid expression so fieldvar access has no valid 'this'.

For the case #2, it will be an error by checkRightThis later. Therefore getRightThis should not make it an error.

src/expression.c Outdated
Copy link
Member

Choose a reason for hiding this comment

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

A brief comment about checkRightThis would be nice here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added comment. Thanks.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry I forgot to push the updated commit. Pushed.

…ple not type Foo

Even if a variable has no valid context, it would be either:

1. a part of compile time evaluated expression, which is used as unreal context.
    enum x = Type.fieldvar.sizeof;
    // It's legitimate expression so fieldvar is not evaluated
    // in runtime.

2. or an invalid field access without valid 'this', in runtime evaluated expression.
    int y = Type.fieldvar;
    // It's invalid expression so fieldvar access has no valid 'this'.

For the case #2, it will be an error by `checkRightThis` later. Therefore `getRightThis` should not make it an error.
@MartinNowak
Copy link
Member

Auto-merge toggled on

Copy link
Member

Choose a reason for hiding this comment

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

I hope that error propagation will make these kind of flags and the gagging superfluous at some point.

MartinNowak added a commit that referenced this pull request Nov 30, 2013
[REG2.064] Issue 11614 - Error: this for _expand_field_0 needs to be type Tuple not type Foo
@MartinNowak MartinNowak merged commit 4d994d6 into dlang:master Nov 30, 2013
@9rnsr 9rnsr deleted the fix11614 branch December 1, 2013 07:34
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