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

[pull] swiftwasm from main #5518

Merged
merged 54 commits into from
Jun 14, 2023
Merged

[pull] swiftwasm from main #5518

merged 54 commits into from
Jun 14, 2023

Commits on Jun 8, 2023

  1. [Test] Remove five second delay in swift-reflection-test startup.

    This was added in ea54c3b, presumably inadvertently.
    mikeash committed Jun 8, 2023
    Configuration menu
    Copy the full SHA
    be3015b View commit details
    Browse the repository at this point in the history

Commits on Jun 10, 2023

  1. [CodeCompletion] Fix an issue that causes an iterator to be invalidat…

    …ed while iterating
    
    In `SourceLookupCache::lookupVisibleDecls`, copy the top level values before iterating them.
    
    If we have 'addinitstotoplevel' enabled, calling 'addConstructorCallsForType' can cause macros to get expanded, which can then cause new members ot get added to 'TopLevelValues', invalidating the current iterator.
    
    I have not been able to reduce this to a test case that doesn’t rely on the `Observation` module in the SDK but here is the test case with which I was able to reproduce the issue very reliably.
    
    ```swift
    import Foundation
    import Observation
    
    @observable class MyObject {}
    
    extension MyObject {}
    
    // RUN: ~/sbin/sourcekitd-test \
    // RUN:   -req=complete.open \
    // RUN:   -req-opts=addinitstotoplevel=1 \
    // RUN:   -pos=8:1 \
    // RUN:   %s \
    // RUN:   -- \
    // RUN:   %s \
    // RUN:   -Xfrontend \
    // RUN:   -load-plugin-library \
    // RUN:   -Xfrontend \
    // RUN:   /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/host/plugins/libObservationMacros.dylib \
    // RUN:   -sdk \
    // RUN:   /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk
    ```
    
    rdar://109202157
    ahoppen committed Jun 10, 2023
    Configuration menu
    Copy the full SHA
    0996342 View commit details
    Browse the repository at this point in the history

Commits on Jun 12, 2023

  1. [ASTScope] Rename and generalize AttachedPropertyWrapperScope to Cust…

    …omAttributeScope
    
    so that it can represent the scope for any custom attribute and its arguments.
    
    This commit is NFC, but CustomAttributeScope is now applicable to attached macros.
    hborla committed Jun 12, 2023
    Configuration menu
    Copy the full SHA
    abcdc6c View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    2c0c596 View commit details
    Browse the repository at this point in the history
  3. [ASTScope] Add APIs for determining whether a given source location i…

    …s inside
    
    a macro argument.
    hborla committed Jun 12, 2023
    Configuration menu
    Copy the full SHA
    cd79cf9 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    2943064 View commit details
    Browse the repository at this point in the history
  5. [NameLookup] Plumb source location arguments through all name lookup …

    …APIs.
    
    This source location will be used to determine whether to add a name lookup
    option to exclude macro expansions when the name lookup request is constructed.
    Currently, the source location argument is unused.
    hborla committed Jun 12, 2023
    Configuration menu
    Copy the full SHA
    cd752cc View commit details
    Browse the repository at this point in the history
  6. [NameLookup] Use source locations to determine whether to exclude macro

    expansions.
    
    Evaluator::hasActiveResolveMacroRequest is now unused.
    hborla committed Jun 12, 2023
    Configuration menu
    Copy the full SHA
    61c99cc View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    db23cf5 View commit details
    Browse the repository at this point in the history
  8. [Macros] Add a test that invokes macro expansion through the conformance

    checker while type checking a freestanding macro argument in the same scope.
    hborla committed Jun 12, 2023
    Configuration menu
    Copy the full SHA
    f9f63e3 View commit details
    Browse the repository at this point in the history
  9. [Macros] Ban freestanding and peer macro expansions that can produce …

    …arbitrary
    
    names at global scope.
    
    Freestanding and peer macros applied at top-level scope cannot introduce
    arbitrary names. Introducing arbitrary names means that any lookup
    into this scope must expand the macro. This is a problem, because
    resolving the macro can invoke type checking other declarations, e.g.
    anything that the macro arguments depend on. If _anything_ the macro
    depends on performs name unqualified name lookup, e.g. type resolution,
    we'll get circularity errors. It's better to prevent this by banning
    these macros at global scope if any of the macro candidates introduce
    arbitrary names.
    hborla committed Jun 12, 2023
    Configuration menu
    Copy the full SHA
    9824954 View commit details
    Browse the repository at this point in the history
  10. [ASTScope] Don't consider freestanding macro expansions as being part…

    … of a
    
    macro argument.
    hborla committed Jun 12, 2023
    Configuration menu
    Copy the full SHA
    0b91f63 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    706411d View commit details
    Browse the repository at this point in the history
  12. [Parser] Reset ASTScopes before performing the IDEInspection second p…

    …ass.
    
    IDE inspection can delay parsing of particular declarations, so expanding
    ASTScopes during the first pass will miss those declarations. Clear any
    expanded scopes to force re-expansion during the second pass.
    hborla committed Jun 12, 2023
    Configuration menu
    Copy the full SHA
    51e1a39 View commit details
    Browse the repository at this point in the history
  13. [NameLookup] Move macro-related name lookup operations into the namel…

    …ookup
    
    namespace.
    
    This moves the `isInMacroArgument` predicate and `lookupMacros` into `namelookup`.
    ASTScope still encapsulates the scope tree and contains the operation to lookup
    the enclosing macro scope, which then invokes a callback to determine whether a
    potential macro scope is indeed a macro, because answering this question requires
    name lookup.
    hborla committed Jun 12, 2023
    Configuration menu
    Copy the full SHA
    393b4ce View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    2cc1204 View commit details
    Browse the repository at this point in the history
  15. [SILGen] Emit block after unreachable when emitting if/switch express…

    …ions
    
    When emitting the underlying `switch` statement
    for a `switch` expression, we emit an `unreachable`
    if the subject is uninhabited. Statement emission
    code can handle this, but expression emission expects
    an RValue to handed back. To remedy this, emit
    an unreachable block that we can emit the rest of
    the expression emission code into. The SILOptimizer
    will then drop this unreachable block.
    hamishknight committed Jun 12, 2023
    Configuration menu
    Copy the full SHA
    cca5a6e View commit details
    Browse the repository at this point in the history
  16. Windows: add some defines from WinUser.h

    Add the windows message queue status flags macros.  This should allow
    the use of the macros when writing Windows code.
    compnerd committed Jun 12, 2023
    Configuration menu
    Copy the full SHA
    490c528 View commit details
    Browse the repository at this point in the history
  17. [CS] Walk into patterns when looking for closure referenced vars

    Previously we would skip over ExprPatterns, but
    we need to ensure that we walk them, as they may
    have interesting variable references that the
    closure needs to be connected to the type
    variables for.
    
    rdar://110617471
    hamishknight committed Jun 12, 2023
    Configuration menu
    Copy the full SHA
    1616e16 View commit details
    Browse the repository at this point in the history
  18. [CS] Walk ExprPattern conjunction elements when finding type variables

    Apply the same logic that we apply to other
    conjunction elements, to make sure that e.g
    property wrapper projected values work correctly.
    
    rdar://110649179
    hamishknight committed Jun 12, 2023
    Configuration menu
    Copy the full SHA
    f18293b View commit details
    Browse the repository at this point in the history
  19. [Backtracing][Linux] Fix Ubuntu 20.04-aarch64 CI failures.

    These seem to be related to signal handling issues in threads that
    have been started presumably by the C library or some other library.
    
    Primarily this appears to affect Ubuntu 20.04 on aarch64, though I
    have seen sporadic issues on 18.04 as well.
    
    We address the problem by making the thread suspension mechanism
    more robust in the face of threads with masked signals.
    
    rdar://110653167
    al45tair committed Jun 12, 2023
    Configuration menu
    Copy the full SHA
    7e632c0 View commit details
    Browse the repository at this point in the history
  20. [CAS] swift dependency scanning using CAS for compiler caching (apple…

    …#66366)
    
    Teach swift dependency scanner to use CAS to capture the full dependencies for a build and construct build commands with immutable inputs from CAS.
    
    This allows swift compilation caching using CAS.
    cachemeifyoucan committed Jun 12, 2023
    Configuration menu
    Copy the full SHA
    b1f99b8 View commit details
    Browse the repository at this point in the history
  21. Merge pull request apple#66532 from hborla/suppress-expansion-in-macr…

    …o-argument
    
    [Macros] Use source locations to determine whether to suppress macro expansions.
    hborla committed Jun 12, 2023
    Configuration menu
    Copy the full SHA
    fc24471 View commit details
    Browse the repository at this point in the history
  22. Configuration menu
    Copy the full SHA
    ae2287d View commit details
    Browse the repository at this point in the history
  23. Configuration menu
    Copy the full SHA
    90a1bb8 View commit details
    Browse the repository at this point in the history
  24. [Test] Update expected macro error

    apple#66497 and
    apple#66482 succeeded separately, then
    merged. But after 66497 the error now includes parentheses.
    
    Resolves rdar://110655182.
    bnbarham committed Jun 12, 2023
    Configuration menu
    Copy the full SHA
    1141e59 View commit details
    Browse the repository at this point in the history
  25. Merge pull request apple#66570 from apple/fix-test-failure

    [Test] Update expected macro error
    tshortli committed Jun 12, 2023
    Configuration menu
    Copy the full SHA
    02c3678 View commit details
    Browse the repository at this point in the history
  26. [Dependency Scanning] Record header dependencies of Binary Swift modu…

    …le dependencies
    
    These are meant to capture paths to the PCH files that a given module was built with.
    artemcm committed Jun 12, 2023
    Configuration menu
    Copy the full SHA
    b974d97 View commit details
    Browse the repository at this point in the history
  27. Merge pull request apple#66517 from ahoppen/ahoppen/iterator-invalida…

    …tion
    
    [CodeCompletion] Fix an issue that causes an iterator to be invalidated while iterating
    ahoppen committed Jun 12, 2023
    Configuration menu
    Copy the full SHA
    9f51c06 View commit details
    Browse the repository at this point in the history
  28. [Dependency Scanning] Emit header dependencies of binary Swift module…

    … dependencies in output and provide libSwiftScan API to query it
    artemcm committed Jun 12, 2023
    Configuration menu
    Copy the full SHA
    92d9e61 View commit details
    Browse the repository at this point in the history
  29. AST: Inherit access level of opaque type decls from naming decl.

    When an `OpaqueTypeDecl` is constructed, the access level attributes of the
    decl that names the opaque type were copied on to it. However, the
    `@usableFromInline` attribute is not permitted on every decl, so it does not
    get copied. This in turn causes access level computations for opaque types to
    fail to take `@usableFromInline` into account and that results in the emitted
    symbol getting the wrong linkage during IRGen. The fix is to make access level
    computations take this quirk of opaque types into account directly (like they
    already to for several other kinds of decls), instead of relying on copying of
    attributes.
    
    Resolves rdar://110544170
    tshortli committed Jun 12, 2023
    Configuration menu
    Copy the full SHA
    775b4a4 View commit details
    Browse the repository at this point in the history
  30. [cxx-interop] Avoid linker errors when calling a defaulted constructor

    When a default constructor is declared, but does not have a body because it is defaulted (`= default;`), Swift did not emit the IR for it. This was causing linker error for types such as `std::map` in libstdc++ when someone tried to initialize such types from Swift.
    
    rdar://110638499 / resolves apple#61412
    egorzhdan committed Jun 12, 2023
    Configuration menu
    Copy the full SHA
    b459fb5 View commit details
    Browse the repository at this point in the history
  31. [ConstraintSystem] Allow generic parameters to bind to holes only in …

    …diagnostic mode
    
    If generic parameter gets opened during regular solving it cannot
    be bound to a hole, that can only happen in diagnostic mode, so
    let's not even try. Doing so also makes sure that there are no
    inference side-effects related to holes because bindings are ranked
    based on their attributes.
    xedin committed Jun 12, 2023
    Configuration menu
    Copy the full SHA
    cfbbb28 View commit details
    Browse the repository at this point in the history

Commits on Jun 13, 2023

  1. Merge pull request apple#66557 from apple/egorzhdan/irgen-defaulted-c…

    …onstructor
    
    [cxx-interop] Avoid linker errors when calling a defaulted constructor
    egorzhdan committed Jun 13, 2023
    Configuration menu
    Copy the full SHA
    9220ec1 View commit details
    Browse the repository at this point in the history
  2. be specific that only escaping closures prevent consumption

    rdar://109908383
    kavon committed Jun 13, 2023
    Configuration menu
    Copy the full SHA
    e715947 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    3e8985b View commit details
    Browse the repository at this point in the history
  4. Merge pull request apple#66515 from tshortli/usable-from-inline-opaqu…

    …e-type-decl-linkage
    
    AST: Inherit access level of an opaque type decl from its naming decl
    tshortli committed Jun 13, 2023
    Configuration menu
    Copy the full SHA
    9bb035f View commit details
    Browse the repository at this point in the history
  5. tailor reinit-after-consume message for closure captures

    rdar://109908383
    kavon committed Jun 13, 2023
    Configuration menu
    Copy the full SHA
    219f94f View commit details
    Browse the repository at this point in the history
  6. Merge pull request apple#66583 from nate-chandler/nfc/20230612/1/cano…

    …nicalize-ossa-lifetime-comments
    
    [CanonicalizeOSSALifetime] Gardening: Tweaked comments.
    swift-ci committed Jun 13, 2023
    Configuration menu
    Copy the full SHA
    8feefce View commit details
    Browse the repository at this point in the history
  7. [GenericEnvironment] Don't apply outer context substitutions before

    type.subst in mapTypeIntoContext.
    
    The outer context substitutions are already applied when invoking
    QueryInterfaceTypeSubstitutions. Applying the context substitutions
    before subst also causes problems because QueryInterfaceTypeSubstitutions
    will return a null type if given an archetype, which manifested with
    opened pack element environments.
    hborla committed Jun 13, 2023
    Configuration menu
    Copy the full SHA
    d6fe625 View commit details
    Browse the repository at this point in the history
  8. Merge pull request apple#66587 from kavon/improve-noncopyable-closure…

    …-diags
    
    Improve noncopyable closure diags
    swift-ci committed Jun 13, 2023
    Configuration menu
    Copy the full SHA
    f79938c View commit details
    Browse the repository at this point in the history
  9. [Runtime] Extract some layout string functionality into separate func…

    …tions (apple#66577)
    
    We want to re-use them for enum layout string instantiation, so best to pull them into separate functions.
    drexin committed Jun 13, 2023
    Configuration menu
    Copy the full SHA
    4ec8276 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    762cd4d View commit details
    Browse the repository at this point in the history
  11. cmake: correctly set NDEBUG for imported headers in SwiftCompilerSources

    So that it's consistent with C++ sources
    
    rdar://110363377
    eeckstein committed Jun 13, 2023
    Configuration menu
    Copy the full SHA
    fa2ac84 View commit details
    Browse the repository at this point in the history
  12. Merge pull request apple#66591 from eeckstein/build-config

    cmake: correctly set NDEBUG for imported headers in SwiftCompilerSources
    swift-ci committed Jun 13, 2023
    Configuration menu
    Copy the full SHA
    954d20b View commit details
    Browse the repository at this point in the history
  13. Fix sign of fractional units in Duration initializers from Double. (a…

    …pple#66582)
    
    * Fix sign of fractional units in Duration initializers from Double.
    
    When separating a double duration into integral and fractional parts, we got the sign wrong. This fixes that bug.
    
    * Fixup variable name.
    stephentyrone committed Jun 13, 2023
    Configuration menu
    Copy the full SHA
    185820a View commit details
    Browse the repository at this point in the history
  14. Merge pull request apple#66556 from artemcm/TransitivePCHDepsOfBinary…

    …Modules
    
    [Dependency Scanning] Record header dependencies of binary Swift module dependencies
    artemcm committed Jun 13, 2023
    Configuration menu
    Copy the full SHA
    18798b6 View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    dd7e177 View commit details
    Browse the repository at this point in the history
  16. Merge pull request apple#66589 from hborla/generic-env-context-substi…

    …tutions
    
    [GenericEnvironment] Don't apply outer context substitutions before `type.subst` in `mapTypeIntoContext`.
    hborla committed Jun 13, 2023
    Configuration menu
    Copy the full SHA
    76ee456 View commit details
    Browse the repository at this point in the history
  17. Merge pull request apple#66555 from compnerd/queued-status

    Windows: add some defines from `WinUser.h`
    compnerd committed Jun 13, 2023
    Configuration menu
    Copy the full SHA
    15e6c6f View commit details
    Browse the repository at this point in the history
  18. Merge pull request apple#66567 from al45tair/eng/PR-110653167

    [Backtracing][Linux] Fix Ubuntu 20.04-aarch64 CI failures.
    al45tair committed Jun 13, 2023
    Configuration menu
    Copy the full SHA
    7145ff0 View commit details
    Browse the repository at this point in the history
  19. Merge pull request apple#65087 from apple/egorzhdan/cxx-set-init

    [cxx-interop] Add `std::set` initializer that takes a Swift Sequence
    egorzhdan committed Jun 13, 2023
    Configuration menu
    Copy the full SHA
    74192c0 View commit details
    Browse the repository at this point in the history
  20. Merge pull request apple#66451 from mikeash/no-reflection-test-sleep

    [Test] Remove five second delay in swift-reflection-test startup.
    mikeash committed Jun 13, 2023
    Configuration menu
    Copy the full SHA
    5125ede View commit details
    Browse the repository at this point in the history
  21. Merge pull request apple#66579 from xedin/allow-holes-in-diagnostic-m…

    …ode-only
    
    [ConstraintSystem] Allow generic parameters to bind to holes only in …
    xedin committed Jun 13, 2023
    Configuration menu
    Copy the full SHA
    7143203 View commit details
    Browse the repository at this point in the history