Skip to content

fix improper determination of 'return this' status#6330

Merged
dlang-bot merged 1 commit intodlang:scopefrom
WalterBright:return-this
Dec 19, 2016
Merged

fix improper determination of 'return this' status#6330
dlang-bot merged 1 commit intodlang:scopefrom
WalterBright:return-this

Conversation

@WalterBright
Copy link
Member

No description provided.

struct Foo12
{
int* foo() return @safe;
}
Copy link
Member

Choose a reason for hiding this comment

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

This is not the test case I provided. The original test case was

int* escape () @safe
{
    int i;
    Foo f;
    f.v = &i;
    return f.foo;
}

struct Foo
{
    int* v;
    int* foo () @safe { return this.v; }
}

And still compiles with this P.R.

Copy link
Member Author

Choose a reason for hiding this comment

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

Well, that was fixed by #6331

The trouble with stacking these PRs is if I don't do it this way there are tedious merge conflicts, especially since the line numbers have to match up.


int* escape13() @safe
{
scope Foo13 f;
Copy link
Member

Choose a reason for hiding this comment

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

I would hold off on any scope class test before the fix in stable gets merged into scope. @MartinNowak ?

Copy link
Member

Choose a reason for hiding this comment

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

I'll try to get it here.

@WalterBright
Copy link
Member Author

This is very strange. The error produced is compiling Phobos unittests:

std\typecons.d(5374): Error: circular typeof definition
std\typecons.d(5374): Error: alias std.typecons.__unittestL5988_127.S.Proxy!(foo).ValueType recursive alias declaration
std\typecons.d(5994): Error: mixin std.typecons.__unittestL5988_127.S.Proxy!(foo) error instantiating\

which does not change even if I disable the changes in this PR.

@WalterBright
Copy link
Member Author

#6331 seems to be the culprit.

@WalterBright WalterBright force-pushed the return-this branch 3 times, most recently from cd21839 to bf5e0ee Compare December 19, 2016 12:51
@WalterBright
Copy link
Member Author

@MartinNowak ready to rock!

Copy link
Member

@MartinNowak MartinNowak left a comment

Choose a reason for hiding this comment

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

I'll do another rebase, things got messed up a bit.

if (global.params.vsafe && tf.isreturn && fd && (ad = fd.isThis()) !is null)
{
if (ad.isClassDeclaration()) // this is 'return scope'
dve.e1.accept(this);
Copy link
Member

Choose a reason for hiding this comment

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

Coverage missing, please add a test case.
Also see https://github.com/codecov/browser-extension.

Copy link
Member

Choose a reason for hiding this comment

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

@WalterBright you may want to install the CodeCov Chrome extension, it nicely shows uncovered lines in red on this page!

---
*/

#line 1000
Copy link
Member

Choose a reason for hiding this comment

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

It rather seems like a good idea to make tests position independent, what's the problem with it?

---
*/

#line 1000
Copy link
Member

Choose a reason for hiding this comment

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

Should be deleted now if you fixed the test.

Copy link
Member

@andralex andralex left a comment

Choose a reason for hiding this comment

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

nice!

if (global.params.vsafe && tf.isreturn && fd && (ad = fd.isThis()) !is null)
{
if (ad.isClassDeclaration()) // this is 'return scope'
dve.e1.accept(this);
Copy link
Member

Choose a reason for hiding this comment

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

@WalterBright you may want to install the CodeCov Chrome extension, it nicely shows uncovered lines in red on this page!

@MartinNowak
Copy link
Member

Just removed the noise from the weird rebase, now it's clearer what this PR actually does.
Still please spend more than 2 seconds writing commit messages and PR descriptions, saves a lot of guesswork on the other side.
"fix improper determination of status" conveys almost no information.

@dlang-bot dlang-bot merged commit bd0dec2 into dlang:scope Dec 19, 2016
@MartinNowak
Copy link
Member

Don't try this at home kids, we're still testing our new auto-merge feature.
https://github.com/MartinNowak/dlang-bot/pull/17

@andralex
Copy link
Member

@MartinNowak COOL COOL COOL!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants