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

merge stable #11027

Merged
merged 34 commits into from Apr 21, 2020
Merged

merge stable #11027

merged 34 commits into from Apr 21, 2020

Conversation

MartinNowak
Copy link
Member

  • bump VERSION to v2.091.1-beta.1
  • Handle mixin expressions as assert conditions
  • Fix misc. issues wrt. temporaries for -checkaction=context lowering
  • Fix Issue 18651 - ice: assert in glue.d:777 when building these three… (Fix Issue 18651 - ice: assert in glue.d:777 when building these three… #10960)
  • Fix issue 20700 - Fwd refs leads to extern(C++, class|struct) being ignored
  • Revert "Fix Issue 20687 - Allow member function address as const initializer"
  • Fix Issue 20692 - Nested alias declarations and getMember trait can crash dmd
  • Fix Issue 20687 - Allow member function address as const initializer
  • Fix Issue 20130 - ICE when casting from string to other array type due to __ArrayCast not being written
  • Fix Issue 20610 - const in a .tupleof loop is ignored
  • Fix Issue 20656 - cannot compile live function without -preview=dip1021
  • Set the DMD binary as executable
  • Fix Issue 20649 - Trait isZeroInit gives false in certain scenarios
  • Follow-up on Fix Issue 17181 - Local imports in templates should be added to impor… #9221

kinke and others added 27 commits March 4, 2020 22:54
[stable] Follow-up on dlang#9221
merged-on-behalf-of: Nicholas Wilson <thewilsonator@users.noreply.github.com>
Fix Issue 20649 - Trait isZeroInit gives false in certain scenarios
merged-on-behalf-of: Nicholas Wilson <thewilsonator@users.noreply.github.com>
The dmd binary must have permission to be executable otherwise it would be
impossible to launch it without manually setting permissions.

This patch sets the 644 permission by default for all the other files installed
through installRelativeFiles while the 755 permissions will be set for the dmd binary.

This fixes the issue #20662
(Fix #20662) Set the DMD binary as executable
merged-on-behalf-of: Nicholas Wilson <thewilsonator@users.noreply.github.com>
Fix Issue 20610 - const in a .tupleof loop is ignored
merged-on-behalf-of: Nicholas Wilson <thewilsonator@users.noreply.github.com>
Fix Issue 20130 - ICE when casting from string to other array type du…
merged-on-behalf-of: Nicholas Wilson <thewilsonator@users.noreply.github.com>
Fix Issue 20656 - cannot compile live function without -preview=dip1021
merged-on-behalf-of: Nicholas Wilson <thewilsonator@users.noreply.github.com>
Fix Issue 20687 - Allow member function address as const initializer
merged-on-behalf-of: Nicholas Wilson <thewilsonator@users.noreply.github.com>
Fix Issue 20692 - Nested alias declarations and getMember trait can c…
…gnored

`Type`-derived AST nodes do not support the same kind of semantic analysis that
`Dsymbol`-derived one do. The issue was that in some codes, semantic analysis on
the type was performed before it was performed on the declaration,
and chasing those cases turned out to be endless, hence the minor refactoring.
[stable] Fix issue 20700 -  Forward references leads to extern(C++, class|struct) being ignored
merged-on-behalf-of: unknown
dlang#10960)

Fix Issue 18651 - ice: assert in glue.d:777 when building these three…
merged-on-behalf-of: Mathias LANG <pro.mathias.lang@gmail.com>
The early expression sema of `exp.e1`, the assert condition, was a major
problem. E.g.:

```
struct S
{
    int a;

    this(this) {}

    bool opEquals(S) @safe
    {
        return true;
    }
}

void foo()
{
    S a;
    assert(S() == a); // S().opEquals(a)
}
```

Here, an lvalue `a` is passed to `S.opEquals()`, which takes the arg by
value. The early `CallExp` sema already lowers the argument expression
`a` to a temporary, to something like
`S __copytmp = (__copytmp = a).__postblit()`. *That* expression (instead
of `a`) was previously stored as a further `__assertOp` temporary, and
the original argument replaced by that temporary (without postblit).

Previous lowering:
assert(S(0).opEquals(((S __assertOp3 = (S __copytmp2 = (__copytmp2 = a).__postblit();) , __assertOp3 = __copytmp2;) , __assertOp3)), _d_assert_fail(S(0), __assertOp3));

New lowering:
assert(S(0).opEquals(((S __copytmp2 = (__copytmp2 = a).__postblit();) , __copytmp2)), _d_assert_fail(S(0), a));

A related 2nd issue concerns rvalue arguments - the early `CallExp` sema
detects that no temporary is needed (move; elide postblit and dtor in the
caller); the rvalue was previously correctly stored as `__assertOp`
temporary, but as it is now an lvalue (possibly accessed a 2nd time for
the `_d_assert_fail()` call if the assertion fails), it must be copied +
postblitted. This can be fixed by deferring the `CallExp` sema until the
arguments have been replaced by required temporaries (and hence possibly
promoted from rvalues to lvalues).

void rval()
{
    static S nonPure()
    {
        __gshared int counter;
        ++counter;
        return S(123);
    }
    assert(S() == nonPure());
}

Previous lowering:
assert(S(0).opEquals(((S __assertOp12 = nonPure();) , __assertOp12)), _d_assert_fail(S(0), __assertOp12));

New lowering:
(S __assertOp11 = nonPure();) , assert(S(0).opEquals(((S __copytmp12 = (__copytmp12 = __assertOp11).__postblit();) , __copytmp12)), _d_assert_fail(S(0), __assertOp11));
For druntime's test/exceptions/src/assert_fail.d.
[stable] Fix misc. issues wrt. temporaries for -checkaction=context lowering
merged-on-behalf-of: Nicholas Wilson <thewilsonator@users.noreply.github.com>
…d errors occurred in compilation

When running semantic on __traits(compiles), errors are gagged, so
the saved errors count is global.gaggedErrors, and not global.errors.

So the condition always evaluated as true if any real errors occured
during compilation, and every subsequent __traits(compiles) errors too,
whether it is valid syntax or not.
fix Issue 20730 - [REG 2.091] __traits(compiles) fails if any ungagged errors occurred in compilation
merged-on-behalf-of: Rainer Schuetze <rainers@users.noreply.github.com>
The const flag being set on the return type triggered switch errors
@dlang-bot
Copy link
Contributor

dlang-bot commented Apr 12, 2020

Thanks for your pull request, @MartinNowak!

Bugzilla references

Auto-close Bugzilla Severity Description
18651 major ice: assert in glue.d:777 when building these three trivial files
20130 regression ICE when casting from string to other array type due to __ArrayCast not being written
20610 critical const in a .tupleof loop is ignored
20649 regression Trait isZeroInit gives false in certain scenarios
20656 normal cannot compile live function without -preview=dip1021
20662 regression dmd: cannot execute: Permission denied
20687 normal Allow member function address as const initializer
20692 normal Nested alias declarations and getMember trait can crash dmd
20700 major Forward references leads to `extern(C++, class
20730 regression [REG 2.091] __traits(compiles) fails if any ungagged errors occurred in compilation

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub run digger -- build "master + dmd#11027"

kinke and others added 2 commits April 12, 2020 23:21
Remove qualifiers from toPrec return type
merged-on-behalf-of: Nicholas Wilson <thewilsonator@users.noreply.github.com>
@MoonlightSentinel
Copy link
Contributor

Fix for the druntime issue: dlang/druntime#3029

dlang-bot and others added 3 commits April 13, 2020 05:39
[stable] 2 small frontend fix-ups after v2.091.0
merged-on-behalf-of: Nicholas Wilson <thewilsonator@users.noreply.github.com>
PR dlang#6621 took the code for pending `ConditionalDeclaration`s from
doc.d but missed the early return.
@MoonlightSentinel
Copy link
Contributor

MoonlightSentinel commented Apr 19, 2020

Another one: dlang/druntime#3044

Fix Issue 20742 - dmd -X (JSON output) includes uncompiled symbols
merged-on-behalf-of: Steven Schveighoffer <schveiguy@users.noreply.github.com>
@MoonlightSentinel
Copy link
Contributor

Needs a rebase

@Geod24
Copy link
Member

Geod24 commented Apr 21, 2020

Done

@MoonlightSentinel
Copy link
Contributor

DlangBot is AFK again?

@MoonlightSentinel MoonlightSentinel merged commit c6ab9c4 into dlang:master Apr 21, 2020
@MartinNowak MartinNowak deleted the merge_stable branch April 23, 2020 01:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
9 participants