Skip to content

Commit

Permalink
Merge pull request #10770 from Geod24/test-following-pr10764
Browse files Browse the repository at this point in the history
Fixup for PR10764: Move fix to the class ctor
merged-on-behalf-of: Nicholas Wilson <thewilsonator@users.noreply.github.com>
  • Loading branch information
dlang-bot committed Feb 7, 2020
2 parents a3dedb2 + 96a9dd5 commit 8a7650e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
3 changes: 3 additions & 0 deletions src/dmd/func.d
Expand Up @@ -3305,6 +3305,9 @@ extern (C++) final class FuncLiteralDeclaration : FuncDeclaration
this.ident = id ? id : Id.empty;
this.tok = tok;
this.fes = fes;
// Always infer scope for function literals
// See https://issues.dlang.org/show_bug.cgi?id=20362
this.flags |= FUNCFLAG.inferScope;
//printf("FuncLiteralDeclaration() id = '%s', type = '%s'\n", this.ident.toChars(), type.toChars());
}

Expand Down
6 changes: 1 addition & 5 deletions src/dmd/semantic3.d
Expand Up @@ -457,11 +457,7 @@ private extern(C++) final class Semantic3Visitor : Visitor
}
}

// infer scope for lambdas even without -preview=dip1000
// See https://issues.dlang.org/show_bug.cgi?id=20362
const isLambda = funcdecl.isFuncLiteralDeclaration;

if ((funcdecl.flags & FUNCFLAG.inferScope || isLambda) && !(fparam.storageClass & STC.scope_))
if ((funcdecl.flags & FUNCFLAG.inferScope) && !(fparam.storageClass & STC.scope_))
stc |= STC.maybescope;

stc |= fparam.storageClass & (STC.in_ | STC.out_ | STC.ref_ | STC.return_ | STC.scope_ | STC.lazy_ | STC.final_ | STC.TYPECTOR | STC.nodtor);
Expand Down

0 comments on commit 8a7650e

Please sign in to comment.