profile
viewpoint

factor/factor 972

Factor programming language

slavapestov/factor 29

Factor programming language - Github mirror of official GIT repo

slavapestov/emerging-langs-talk 7

Slides and sample code from Emerging Languages Camp 2010

slavapestov/boston-lisp-talk 2

Talk at Boston Lisp User's Group, July 2010

slavapestov/swift 2

The Swift Programming Language

slavapestov/swift-corelibs-foundation 0

The Foundation Project, providing core utilities, internationalization, and OS independence

slavapestov/swift-corelibs-libdispatch 0

The libdispatch Project, (a.k.a. Grand Central Dispatch), for concurrency on multicore hardware

slavapestov/swift-corelibs-xctest 0

The XCTest Project, A Swift core library for providing unit test support

pull request commentapple/swift

Put the AvailabilityContext into the ExportContext

@swift-ci Please test

slavapestov

comment created time in 12 hours

pull request commentapple/swift

Put the AvailabilityContext into the ExportContext

@swift-ci Please test source compatibility

slavapestov

comment created time in 12 hours

pull request commentapple/swift

Put the AvailabilityContext into the ExportContext

@swift-ci Please smoke test

slavapestov

comment created time in 12 hours

push eventslavapestov/swift

Slava Pestov

commit sha d5ee1da9bb3e723c8c8215d4c30bbdd6bfbbb3b8

Sema: Put the AvailabilityContext inside the ExportContext

view details

Slava Pestov

commit sha fd38c4d18a69994b17cd29a6bbc5747dd0072f27

Sema: Pass ExportContext by const reference where possible

view details

Slava Pestov

commit sha f3cbef87d90531243405227be5e1cf1b83cf237c

Sema: Check result builder availability

view details

push time in 12 hours

PR opened apple/swift

Put the AvailabilityContext into the ExportContext

Let's put OS version information into the ExportContext, so that we only have to perform the source location lookup once.

+205 -137

0 comment

15 changed files

pr created time in a day

create barnchslavapestov/swift

branch : export-context-os-version

created branch time in a day

push eventapple/swift

Slava Pestov

commit sha 51c1fa9e08fb61fc39bc5ecacb711bfb45d4a86a

SILGen: Fix assertion failure when emitting foreign-to-native thunk for a method with inout 'self' We import a C function taking a non-const pointer 'self' parameter as a mutating method. The getParameterTypes() helper method in SILGenBridging.cpp would assert upon encountering the inout 'self' parameter, even though emitForeignToNativeThunk() would still emit correct code as long as the 'self' type was not bridged. Relax the assertion a bit to hopefully still catch bugs where other parameters are unexpectedly 'inout', but allow it on 'self', and add a test. Fixes <rdar://problem/70346482>.

view details

Slava Pestov

commit sha 5910d82a7b1d810f719f0bf4e018090dcb1efcaf

Merge pull request #34456 from slavapestov/foreign-to-native-inout-self SILGen: Fix assertion failure when emitting foreign-to-native thunk for a method with inout 'self'

view details

push time in 2 days

PR merged apple/swift

SILGen: Fix assertion failure when emitting foreign-to-native thunk for a method with inout 'self'

We import a non-const pointer 'self' type as a mutating method.

The getParameterTypes() helper method in SILGenBridging.cpp would assert upon encountering the inout 'self' parameter, even though emitForeignToNativeThunk() would still emit correct code as long as the 'self' type was not bridged.

Relax the assertion a bit to hopefully still catch bugs where other parameters are unexpectedly 'inout', but allow it on 'self', and add a test.

Fixes rdar://problem/70346482.

+38 -6

4 comments

3 changed files

slavapestov

pr closed time in 2 days

pull request commentapple/swift

SILGen: Fix assertion failure when emitting foreign-to-native thunk for a method with inout 'self'

@swift-ci Please smoke test Linux

slavapestov

comment created time in 2 days

push eventslavapestov/swift

Slava Pestov

commit sha 51c1fa9e08fb61fc39bc5ecacb711bfb45d4a86a

SILGen: Fix assertion failure when emitting foreign-to-native thunk for a method with inout 'self' We import a C function taking a non-const pointer 'self' parameter as a mutating method. The getParameterTypes() helper method in SILGenBridging.cpp would assert upon encountering the inout 'self' parameter, even though emitForeignToNativeThunk() would still emit correct code as long as the 'self' type was not bridged. Relax the assertion a bit to hopefully still catch bugs where other parameters are unexpectedly 'inout', but allow it on 'self', and add a test. Fixes <rdar://problem/70346482>.

view details

push time in 2 days

push eventslavapestov/swift

Slava Pestov

commit sha aa452210f8152b012bddad94aba73022abf0613f

SILGen: Fix assertion failure when emitting foreign-to-native thunk for a method with inout 'self' We import a C function taking a non-const pointer 'self' parameter as a mutating method. The getParameterTypes() helper method in SILGenBridging.cpp would assert upon encountering the inout 'self' parameter, even though emitForeignToNativeThunk() would still emit correct code as long as the 'self' type was not bridged. Relax the assertion a bit to hopefully still catch bugs where other parameters are unexpectedly 'inout', but allow it on 'self', and add a test. Fixes <rdar://problem/70346482>.

view details

push time in 2 days

PR opened apple/swift

SILGen: Fix assertion failure when emitting foreign-to-native thunk for a method with inout 'self'

We import a non-const pointer 'self' type as a mutating method.

The getParameterTypes() helper method in SILGenBridging.cpp would assert upon encountering the inout 'self' parameter, even though emitForeignToNativeThunk() would still emit correct code as long as the 'self' type was not bridged.

Relax the assertion a bit to hopefully still catch bugs where other parameters are unexpectedly 'inout', but allow it on 'self', and add a test.

Fixes rdar://problem/70346482.

+41 -6

0 comment

3 changed files

pr created time in 2 days

create barnchslavapestov/swift

branch : foreign-to-native-inout-self

created branch time in 2 days

push eventapple/swift

Slava Pestov

commit sha 527fb5dd315926a4301ebeba11c367d705c682d1

SIL: Enum protocol witness thunks should be [serializable]

view details

Slava Pestov

commit sha 54134884af7cb80aed7d593f7750f6f722a2137a

SILGen: Fix crash in emitEnumConstructor() if type lowering depends on resilience It's possible that the result value here is passed indirectly, but the enum value is loadable inside the constructor's body. Let's make sure we handle this correctly. Fixes https://bugs.swift.org/browse/SR-12966 / rdar://problem/70395861.

view details

Slava Pestov

commit sha fa4e814d1c26f75b64c49a6df9e059745ea8dbe9

Merge pull request #34421 from slavapestov/enum-protocol-witness-vs-resilience SILGen: Fix crash in emitEnumConstructor() if type lowering depends on resilience

view details

push time in 5 days

PR merged apple/swift

SILGen: Fix crash in emitEnumConstructor() if type lowering depends on resilience

It's possible that the result value here is passed indirectly, but the enum value is loadable inside the constructor's body. Let's make sure we handle this correctly.

Fixes https://bugs.swift.org/browse/SR-12966 / rdar://problem/70395861.

+27 -11

1 comment

3 changed files

slavapestov

pr closed time in 5 days

pull request commentapple/swift

SILGen: Fix crash in emitEnumConstructor() if type lowering depends on resilience

@swift-ci Please smoke test

slavapestov

comment created time in 5 days

PR opened apple/swift

SILGen: Fix crash in emitEnumConstructor() if type lowering depends on resilience

It's possible that the result value here is passed indirectly, but the enum value is loadable inside the constructor's body. Let's make sure we handle this correctly.

Fixes https://bugs.swift.org/browse/SR-12966 / rdar://problem/70395861.

+27 -11

0 comment

3 changed files

pr created time in 5 days

create barnchslavapestov/swift

branch : enum-protocol-witness-vs-resilience

created branch time in 5 days

push eventapple/swift

Slava Pestov

commit sha b3578abe693a779fb35ca28c2f45b540fb8524d0

Add regression test for https://bugs.swift.org/browse/SR-12473 / rdar://problem/61111969

view details

Slava Pestov

commit sha acef0261fc65f69a73d8bc4fdb8723fe09e48814

Add regression test for https://bugs.swift.org/browse/SR-13727 / rdar://problem/70298061

view details

Slava Pestov

commit sha 93f22cd200dc7aaaf1dde8c93551e3a4f4361424

Merge pull request #34420 from slavapestov/two-regression-tests Two regression tests

view details

push time in 5 days

PR merged apple/swift

Two regression tests
+67 -0

1 comment

2 changed files

slavapestov

pr closed time in 5 days

push eventapple/swift

Slava Pestov

commit sha 360e406d3a01ec0d41b72a34cbd6d0f8ac91bf2b

SIL: Rename SILFunction::hasSelfMetadataParam()/getSelfMetadataArgument() These are only for class types and are related to the usage of the DynamicSelfType, so rename them to {has,get}DynamicSelfMetadata().

view details

Slava Pestov

commit sha 7f2b01ccb37a090c40ad423df5c35830b018312f

DI: Fix crash when value_metatype was used with a non-class 'self' type In a constructor, SILGen lowers type(of: self) to a value_metatype instruction, but 'self' might not have been initialized yet if this is a convenience initializer, so we replace it with a use of the 'self' metatype argument. However getDynamicSelfMetadata() asserts if 'self' is a non-class type. Since we know we're inside of a proper method here and not a closure that captured 'self', we can use getSelfArgument() instead. Fixes https://bugs.swift.org/browse/SR-12665 / rdar://problem/62481587.

view details

Slava Pestov

commit sha 37f2bc1e5993f9db5ccdc6ab82f5eb5580fc6206

DI: Add non-working code for handling value_metatype when used on an address-only type

view details

Slava Pestov

commit sha 442fc684538b396248c3afc957119381f22ed88b

Merge pull request #34419 from slavapestov/type-of-self-protocol-convenience-init DI: Fix crash when value_metatype was used with a non-class 'self' type

view details

push time in 5 days

PR merged apple/swift

DI: Fix crash when value_metatype was used with a non-class 'self' type

Fixes https://bugs.swift.org/browse/SR-12665 / rdar://problem/62481587.

+177 -84

2 comments

16 changed files

slavapestov

pr closed time in 5 days

pull request commentapple/swift

DI: Fix crash when value_metatype was used with a non-class 'self' type

@swift-ci Please smoke test

slavapestov

comment created time in 6 days

push eventslavapestov/swift

Slava Pestov

commit sha 7f2b01ccb37a090c40ad423df5c35830b018312f

DI: Fix crash when value_metatype was used with a non-class 'self' type In a constructor, SILGen lowers type(of: self) to a value_metatype instruction, but 'self' might not have been initialized yet if this is a convenience initializer, so we replace it with a use of the 'self' metatype argument. However getDynamicSelfMetadata() asserts if 'self' is a non-class type. Since we know we're inside of a proper method here and not a closure that captured 'self', we can use getSelfArgument() instead. Fixes https://bugs.swift.org/browse/SR-12665 / rdar://problem/62481587.

view details

Slava Pestov

commit sha 37f2bc1e5993f9db5ccdc6ab82f5eb5580fc6206

DI: Add non-working code for handling value_metatype when used on an address-only type

view details

push time in 6 days

pull request commentapple/swift

DI: Fix crash when value_metatype was used with a non-class 'self' type

I filed a radar to get the address-only case working: rdar://70640292. This should also improve performance -Onone builds.

slavapestov

comment created time in 6 days

pull request commentapple/swift

Two regression tests

@swift-ci Please smoke test

slavapestov

comment created time in 6 days

PR opened apple/swift

Two regression tests
+67 -0

0 comment

2 changed files

pr created time in 6 days

pull request commentapple/swift

DI: Fix crash when value_metatype was used with a non-class 'self' type

@swift-ci Please smoke test

slavapestov

comment created time in 6 days

PR opened apple/swift

DI: Fix crash when value_metatype was used with a non-class 'self' type

Fixes https://bugs.swift.org/browse/SR-12665 / rdar://problem/62481587.

+122 -59

0 comment

14 changed files

pr created time in 6 days

create barnchslavapestov/swift

branch : type-of-self-protocol-convenience-init

created branch time in 6 days

create barnchslavapestov/swift

branch : two-regression-tests

created branch time in 6 days

push eventapple/swift

Slava Pestov

commit sha 051f4c41df712561601eb4c66066e9f938aa5397

Sema: Improve comments based on code review feedback

view details

Slava Pestov

commit sha 0f27312790af84e76b1fd53fc265482257fc9020

Sema: Refactor TypeChecker::diagnoseInlinableDeclRef()

view details

Slava Pestov

commit sha b3dadc8973dd680d75f4ab110b60660c5811b6a3

AST: Use VarDecl::isInitExposedToClients() from DeclContext::getFragileFunctionKind() getFragileFunctionKind() would report that all initializers in non-resilient public types were inlinable, including static properties. This was later patched by VarDecl::isInitExposedToClients(), which was checked in diagnoseInlinableDeclRefAccess(). However, the latter function only looked at the innermost DeclContexts, not all parent contexts, so it would incorrectly diagnose code with a nested DeclContext inside of a static property initializer. Fix this by changing getFragileFunctionKind() to call isInitExposedToClients() and simplifying diagnoseInlinableDeclRefAccess(). This commit also introduces a new isLayoutExposedToClients() method, which is similar to isInitExposedToClients(), except it also returns 'true' if the property does not have an initializer (and in fact the latter is implemented in terms of the former).

view details

Slava Pestov

commit sha 5f5372a3fca19e7fd9f67e79b7f9ddbc12e467fe

Sema: Don't check SPI violations in diagnoseInlinableDeclRefAccess() There's no need to check for that here, because we also run diagnoseDeclRefExportability() on declarations referenced from inlinable code. This changes some diagnostics; we now produce the same diagnostic for references to SPI types in declaration signatures and for references to non-type SPI declarations in inlinable function bodies. Also note that the old inlinable reference diagnostic no longer has to handle the 'public' and 'open' access levels, which previously happened for '@_spi'; so I changed those entries in the %select to %error.

view details

Slava Pestov

commit sha 0dffe5c3484e610eb23f289d34dfd461cea48aac

Sema: Use VarDecl::isLayoutExposedToClients() when checking access in @frozen structs We require that all stored properties in a @frozen struct have public or @usableFromInline types, even if the property itself is not public. This is so that clients can correctly generate code to manipulate the @frozen struct. This check was only looking for bona-fide stored properties, and missing out looking at properties that have backing storage, namely 'lazy' properties and property wrappers.

view details

Slava Pestov

commit sha b4c568e2d1256d834c9bda5f9306c50a20c8ea63

Sema: Use VarDecl::isLayoutExposedToClients() when checking if @_spi attribute is allowed We need to prohibit 'lazy' properties and property wrappers from being declared @_spi inside of a @frozen struct. Making them SPI doesn't make sense, because these properties will be omitted from the module interface and not taken into account when clients manipulate values of this type.

view details

Slava Pestov

commit sha 01bc77406194d90b6288054e73caea6bb6d8b9b6

Sema: Enforce that stored properties of @_fixed_layout classes only reference public types This is the same restriction as with @frozen structs. Even though classes are lowered as a single reference and clients don't usually manipulate their stored property layout directly, @frozen classes can have @inlinable designated initializers.

view details

Slava Pestov

commit sha fa50221d355ec383690c236dbe790116b36c0733

Sema: Use VarDecl::isLayoutExposedToClients() when checking VarDecl exportability

view details

Slava Pestov

commit sha 587a8dafb9d1ea8959c9721878e2f4c430697df0

Sema: Don't forget to visit conformances introduced by non-generic types Even if a nominal type does not have its own generic parameters, we need to visit its conformances, because it might be defined in a constrained extension or have a 'where' clause of its own.

view details

Slava Pestov

commit sha 8af4405f36e214cd6f6b1789431a5c505548e89b

AST: 'lazy' property initializers are never @inlinable In @frozen structs, stored properties and property wrappers must have inlinable initial value expressions, since they are re-emitted into designated initializer bodies, which themselves might be @inlinable. However, 'lazy' properties don't follow this pattern; the initial value expression is emitted inside the getter, which is never @inlinable.

view details

Slava Pestov

commit sha fe89764a8a17c6cf706369a748f5c4b5936440d0

Merge pull request #34390 from slavapestov/misc-availability-fixes Another pile of availability checking fixes

view details

push time in 7 days

PR merged apple/swift

Reviewers
Another pile of availability checking fixes

See the individual commits for details.

+359 -199

6 comments

20 changed files

slavapestov

pr closed time in 7 days

pull request commentapple/swift

Another pile of availability checking fixes

@swift-ci Please test source compatibility

slavapestov

comment created time in 7 days

pull request commentapple/swift

Another pile of availability checking fixes

@swift-ci Please test

slavapestov

comment created time in 7 days

push eventslavapestov/swift

Slava Pestov

commit sha fa50221d355ec383690c236dbe790116b36c0733

Sema: Use VarDecl::isLayoutExposedToClients() when checking VarDecl exportability

view details

Slava Pestov

commit sha 587a8dafb9d1ea8959c9721878e2f4c430697df0

Sema: Don't forget to visit conformances introduced by non-generic types Even if a nominal type does not have its own generic parameters, we need to visit its conformances, because it might be defined in a constrained extension or have a 'where' clause of its own.

view details

Slava Pestov

commit sha 8af4405f36e214cd6f6b1789431a5c505548e89b

AST: 'lazy' property initializers are never @inlinable In @frozen structs, stored properties and property wrappers must have inlinable initial value expressions, since they are re-emitted into designated initializer bodies, which themselves might be @inlinable. However, 'lazy' properties don't follow this pattern; the initial value expression is emitted inside the getter, which is never @inlinable.

view details

push time in 7 days

pull request commentapple/swift

Another pile of availability checking fixes

@swift-ci Please test

slavapestov

comment created time in 7 days

pull request commentapple/swift

Another pile of availability checking fixes

@swift-ci Please test source compatibility

slavapestov

comment created time in 7 days

PR opened apple/swift

Another pile of availability checking fixes

See the individual commits for details.

+333 -193

0 comment

18 changed files

pr created time in 7 days

push eventslavapestov/swift

Meghana Gupta

commit sha 0044e7dcac6ff176be0945ba0f468967979779d3

[ownership] Move OME past SILMem2Reg

view details

Meghana Gupta

commit sha 8145566b7d72834b8e29eebe4f275d1c8d4411c0

Merge pull request #34380 from meg-gupta/moveomepastmem2reg [ownership] Move OME past SILMem2Reg

view details

Zoe Carver

commit sha f0f22467931f7410bff76248806b94a9d5e64537

[cxx-interop] Support C++ function templates in Swift. (#33053) This patch adds rudimentary support for C++ template functions in swift.

view details

Slava Pestov

commit sha 051f4c41df712561601eb4c66066e9f938aa5397

Sema: Improve comments based on code review feedback

view details

Slava Pestov

commit sha 0f27312790af84e76b1fd53fc265482257fc9020

Sema: Refactor TypeChecker::diagnoseInlinableDeclRef()

view details

Slava Pestov

commit sha b3dadc8973dd680d75f4ab110b60660c5811b6a3

AST: Use VarDecl::isInitExposedToClients() from DeclContext::getFragileFunctionKind() getFragileFunctionKind() would report that all initializers in non-resilient public types were inlinable, including static properties. This was later patched by VarDecl::isInitExposedToClients(), which was checked in diagnoseInlinableDeclRefAccess(). However, the latter function only looked at the innermost DeclContexts, not all parent contexts, so it would incorrectly diagnose code with a nested DeclContext inside of a static property initializer. Fix this by changing getFragileFunctionKind() to call isInitExposedToClients() and simplifying diagnoseInlinableDeclRefAccess(). This commit also introduces a new isLayoutExposedToClients() method, which is similar to isInitExposedToClients(), except it also returns 'true' if the property does not have an initializer (and in fact the latter is implemented in terms of the former).

view details

Slava Pestov

commit sha 5f5372a3fca19e7fd9f67e79b7f9ddbc12e467fe

Sema: Don't check SPI violations in diagnoseInlinableDeclRefAccess() There's no need to check for that here, because we also run diagnoseDeclRefExportability() on declarations referenced from inlinable code. This changes some diagnostics; we now produce the same diagnostic for references to SPI types in declaration signatures and for references to non-type SPI declarations in inlinable function bodies. Also note that the old inlinable reference diagnostic no longer has to handle the 'public' and 'open' access levels, which previously happened for '@_spi'; so I changed those entries in the %select to %error.

view details

Slava Pestov

commit sha 0dffe5c3484e610eb23f289d34dfd461cea48aac

Sema: Use VarDecl::isLayoutExposedToClients() when checking access in @frozen structs We require that all stored properties in a @frozen struct have public or @usableFromInline types, even if the property itself is not public. This is so that clients can correctly generate code to manipulate the @frozen struct. This check was only looking for bona-fide stored properties, and missing out looking at properties that have backing storage, namely 'lazy' properties and property wrappers.

view details

Slava Pestov

commit sha b4c568e2d1256d834c9bda5f9306c50a20c8ea63

Sema: Use VarDecl::isLayoutExposedToClients() when checking if @_spi attribute is allowed We need to prohibit 'lazy' properties and property wrappers from being declared @_spi inside of a @frozen struct. Making them SPI doesn't make sense, because these properties will be omitted from the module interface and not taken into account when clients manipulate values of this type.

view details

Slava Pestov

commit sha 01bc77406194d90b6288054e73caea6bb6d8b9b6

Sema: Enforce that stored properties of @_fixed_layout classes only reference public types This is the same restriction as with @frozen structs. Even though classes are lowered as a single reference and clients don't usually manipulate their stored property layout directly, @frozen classes can have @inlinable designated initializers.

view details

Slava Pestov

commit sha d3a81710e9d5a963075b6d85cdc41aafb0cd7617

Sema: Use VarDecl::isLayoutExposedToClients() when checking VarDecl exportability

view details

Slava Pestov

commit sha 168e29e96f4e3fe4de18945d388ef9b060d80381

Sema: Don't forget to visit conformances introduced by non-generic types inside constrained extensions

view details

Slava Pestov

commit sha 3b16db72421667134be9eee9c676152075531912

AST: 'lazy' property initializers are never @inlinable In @frozen structs, stored properties and property wrappers must have inlinable initial value expressions, since they are re-emitted into designated initializer bodies, which themselves might be @inlinable. However, 'lazy' properties don't follow this pattern; the initial value expression is emitted inside the getter, which is never @inlinable.

view details

push time in 7 days

create barnchslavapestov/swift

branch : misc-availability-fixes

created branch time in 7 days

push eventapple/swift

Slava Pestov

commit sha 548b96a9ff48861a99d7251648f48e3eb8d90d25

Sema: Add documentation comments for ExportContext

view details

Slava Pestov

commit sha d579b697f6c104cf4f7469ca6b0081193c6e2347

Sema: Teach ExportContext to compute whether we're inside a deprecated declaration

view details

Slava Pestov

commit sha 78d2cf2ee945031e0113056d4ea221b3ce772ccb

Sema: Teach ExportContext to compute whether we're inside an implicit declaration

view details

Slava Pestov

commit sha 85d24953de5c14eb83e4c8492bacd2eef4869986

Sema: Teach ExportContext to compute whether we're inside an unavailable declaration

view details

Slava Pestov

commit sha be73343f359b17d25d1978910806bd8c10802048

Merge pull request #34372 from slavapestov/more-export-context-refactoring Generalize ExportContext and use it for deprecation and unavailability

view details

push time in 8 days

pull request commentapple/swift

Generalize ExportContext and use it for deprecation and unavailability

@xymus I'll fix the comments in my next PR since it's almost ready to go up anyway. Thanks for the review!

slavapestov

comment created time in 8 days

Pull request review commentapple/swift

Generalize ExportContext and use it for deprecation and unavailability

 enum class ExportabilityReason : unsigned {   ExtensionWithConditionalConformances }; +/// A description of the restrictions on what declarations can be referenced+/// from a the signature or body of a declaration.+///+/// We say a declaration is "exported" if it is `public` or+/// `@usableFromInline`, not `_@spi`, and not visible via an

Thanks!

slavapestov

comment created time in 8 days

PullRequestReviewEvent

Pull request review commentapple/swift

Generalize ExportContext and use it for deprecation and unavailability

 enum class ExportabilityReason : unsigned {   ExtensionWithConditionalConformances }; +/// A description of the restrictions on what declarations can be referenced+/// from a the signature or body of a declaration.+///+/// We say a declaration is "exported" if it is `public` or+/// `@usableFromInline`, not `_@spi`, and not visible via an+/// `@_implementationOnly` import.+///+/// The "signature" of a declaration is the set of all types written in the+/// declaration (such as function parameter and return types), but not+/// including the function body.+///+/// The signature of an exported declaration can only reference other+/// exported types.+///+/// The body of an inlinable function can only reference other `public` and+/// `@usableFromInline` declarations; furthermore, if the inlinable+/// function is also exported, its body is restricted to referencing other+/// exported declarations.

Yep

slavapestov

comment created time in 8 days

PullRequestReviewEvent

pull request commentapple/swift

Generalize ExportContext and use it for deprecation and unavailability

@swift-ci Please test source compatibility

slavapestov

comment created time in 9 days

pull request commentapple/swift

Generalize ExportContext and use it for deprecation and unavailability

@swift-ci Please smoke test

slavapestov

comment created time in 9 days

create barnchslavapestov/swift

branch : more-export-context-refactoring

created branch time in 9 days

push eventapple/swift

Slava Pestov

commit sha 0c51dda34b3b24635c921459bec40175b4205040

Sema: Pull @_implementationOnly override checking out of ExportabilityChecker

view details

Slava Pestov

commit sha 0ea136738473696004aa7b9b14a449f4ba3bea26

Sema: Refactoring in preparation for conformance availability checking Today, we check conformance exportability in two places: 1) For inlinable function bodies: in availability checking 2) For types in inlinable declaration signatures: in availability checking 3) For types in non-inlinable declaration signatures: in ExportabilityChecker I want to merge 2) and 3) together, and also generalize the conformance exportability check to check conformance availability as well. This is a preliminary refactoring towards achieving this goal.

view details

Slava Pestov

commit sha 50c44c202634136a82a3534aad7651f974709d28

Sema: Don't desugar the type when diagnosing unexportable Clang function types

view details

Slava Pestov

commit sha f48aa518842d9fc27b352a227868e98fa5f369a4

Sema: Remove ExportabilityChecker Availability checking already knows how to check exportability for types and conformances referenced from inlinable function signatures and bodies. Let's generalize this to work on non-inlinable function signatures as well, allowing us to get rid of the ExportabilityChecker altogether.

view details

Slava Pestov

commit sha e10df96983f337dda96be6797b1e0be7fb676391

Sema: Fold TypeChecker::isDeclAvailable() into its callers

view details

Slava Pestov

commit sha c2ed3476658ec9adad8895694a36f2abf85f7a9e

Sema: Pass ValueDecl instead of ConcreteDeclRef in a few places in availability checking The substitution map is checked elsewhere.

view details

Slava Pestov

commit sha 9f08ab3918a6f83d34671e8c72c4c002e595f801

Sema: Remove an unnecessary overload of TypeChecker::diagnosePotentialUnavailability()

view details

Slava Pestov

commit sha 3044c057e8b2a11f14b38d6445c430c54ca11802

Sema: Wrap up some availability-related state in a new ExportContext type The ExportContext describes the restrictions, if any, on what declarations can be uttered in a specific place in the program. Here, the place is either the signature of a declaration, or the body of a function.

view details

Slava Pestov

commit sha a824e5a33b63a9b2ef7ed49e78993cd79baec968

Sema: Refactor getDisallowedOriginKind() to take an ExportContext Converting the innermost DeclContext into a Decl won't work if the innermost DeclContext is the parent context of a VarDecl. Instead, use the relevant bit of state from the ExportContext, which is computed correctly. This fixes a regression caused by an earlier commit in this PR which our test suite did not catch.

view details

Slava Pestov

commit sha c0d664dd156da7de0814eb5a9504d489023bc390

Merge pull request #34329 from slavapestov/nuke-exportability-checker Fold exportability checking into availability checking

view details

push time in 9 days

PR merged apple/swift

Reviewers
Fold exportability checking into availability checking

In the previous PR, I introduced DeclAvailabilityChecker. The division of labor was as follows:

  • DeclAvailabilityChecker would diagnose references to unexported types from inlinable function signatures
  • ExportabilityChecker would diagnose references to unexported types from non-inlinable function signatures
  • The existing availability check would diagnose references to unexported declarations from inlinable function bodies

This PR folds ExportabilityChecker into DeclAvailabilityChecker, merging the first two code paths, and prepares the availability checking code to look at conformance availability as well as conformance exportability.

Builds upon https://github.com/apple/swift/pull/34325.

+615 -847

8 comments

14 changed files

slavapestov

pr closed time in 9 days

pull request commentapple/swift

Fold exportability checking into availability checking

@swift-ci Please test source compatibility

slavapestov

comment created time in 9 days

pull request commentapple/swift

Fold exportability checking into availability checking

@swift-ci Please test source compatibility

slavapestov

comment created time in 9 days

pull request commentapple/swift

Fold exportability checking into availability checking

@swift-ci Please smoke test

slavapestov

comment created time in 9 days

push eventslavapestov/swift

Joe Groff

commit sha 3364c51b1d53fd22a3adbaf3d406bd6685535221

SIL: Verify invariants of async_continuation instructions. - Enforce types of continuations and resume/error BBargs for await - Can't access the continuation again or exit the function mid-suspend

view details

Pavel Yaskevich

commit sha 17f7ad82cac717a0be4e8417a136348fb0365ca9

[CSBindings] Record all of the protocol requirements (not just literal)

view details

Pavel Yaskevich

commit sha 0c51159228992019f029530844d7c482256b2ed2

[CSBindings] Record constraint associated with a subtype relationship While inferring bindings, let's record not only the fact that current type variable is a subtype of some other type variable but track constraint which establishes this relationship.

view details

Pavel Yaskevich

commit sha a9cce605a4a4062366ce7c4ef2afedd055e79f2c

[CSBindings] Shrink binding "sources" to supertype and equivalence only Instead of recording all of the binding "sources" let's only record subtype, supertype and equivalence relationships which didn't materialize as bindings (because other side is a type variable). This is the only information necessary to infer transitive bindings and protocol requirements.

view details

Pavel Yaskevich

commit sha d011bf3d7d72adc8235d336a202241f8cda62971

[CSBindings] Implement transtive protocol requirement inference Implements iterative protocol requirement inference through subtype, conversion and equivalence relationships. This algorithm doesn't depend on a type variable finalization order (which is currently the order of type variable introduction). If a given type variable doesn't yet have its transitive protocol requirements inferred, algorithm would use iterative depth-first walk through its supertypes and equivalences and incrementally infer transitive protocols for each type variable involved, transferring new information down the chain e.g. T1 T3 \ / T4 T5 \ / T2 Here `T1`, `T3` are supertypes of `T4`, `T4` and `T5` are supertypes of `T2`. Let's assume that algorithm starts at `T2` and none of the involved type variables have their protocol requirements inferred yet. First, it would consider supertypes of `T2` which are `T4` and `T5`, since `T5` is the last in the chain algorithm would transfer its direct protocol requirements to `T2`. `T4` has supertypes `T1` and `T3` - they transfer their direct protocol requirements to `T4` and `T4` transfers its direct and transitive (from `T1` and `T3`) protocol requirements to `T2`. At this point all the type variables in subtype chain have their transitive protocol requirements resolved and cached so they don't have to be re-inferred later.

view details

Pavel Yaskevich

commit sha 5dc9919aff788fc71ab69603db997f0a45ca258e

[ConstraintSystem] NFC: Make `SemaTest` a friend of `ConstraintSystem` This is necessary in order to have access to private members of a `ConstraintSystem` for testing purposes, such as logic related to potential binding computation.

view details

Pavel Yaskevich

commit sha 1aecea17e41bde3508326c9ae72c47b432ed5c15

[unittest/Sema] Add a helper method to infer bindings for a given type variable This mimics what `determineBestBindings` does but without sorting.

view details

Pavel Yaskevich

commit sha a24383112214c2a23a2008f5b704a0acb513b9fe

[unittest/Sema] Add a test-case for a single hop protocol requirement inference In situations like: `$T0 <convertible> $T1` `$T1 <conforms to> P` `$T0` should know about `P` as a transitive protocol requirement.

view details

Pavel Yaskevich

commit sha 8024b7bef3a3907299656eab5c0dc9ac844a5d05

[CSBindings] Improve equivalence class handling in transitive protocol inference Let all of the members of the equivalence class be represented by the first type variable encountered during the depth-first walk. This means that supertypes are inferred from the members and all of the transitive protocol requirements are distributed among the members upon return back to the "representative".

view details

Pavel Yaskevich

commit sha a3c3981a68f9672e48823fda0661c06df5c9fbc3

[unittest/Sema] NFC: Add a way to create a protocol with a given name and parent type

view details

Pavel Yaskevich

commit sha 9598f1984833a76aaa38cdb080bf997e28dacd1b

[unittest/Sema] Cover transitive protocol inference with unit tests

view details

Nathan Hawes

commit sha 15f5222bbdf357f3c23c12bd07434b64f4d2500a

[CodeCompletion][Sema] Allow missing args when solving if the completion location indicates the user may intend to write them later. func foo(a: Int, b: Int) {} func foo(a: String) {} // Int and String should both be valid, despite the missing argument for the // first overload since the second arg may just have not been written yet. foo(a: <complete here> func bar(a: (Int) -> ()) {} func bar(a: (String, Int) -> ()) {} // $0 being of type String should be valid, rather than just Int, since $1 may // just have not been written yet. bar { $0.<complete here> }

view details

Slava Pestov

commit sha 6a5684a76c424af9a86ef3c6893ed7428899092f

Sema: Allow duplicate internal parameter names on protocol requirements This fixes a recent source compatibility regression. Fixes <rdar://problem/70445751>.

view details

Slava Pestov

commit sha c39bb8970a85c5e5a12c69ff52d4b7216b81aea8

Add regression test for https://bugs.swift.org/browse/SR-8456

view details

Michelle Casbon

commit sha a5034bc22bb825dad61fcd8d1b1a65f87f019bf0

Correct path in Windows build guide

view details

Pavel Yaskevich

commit sha 59e8043cb97a1ea096eec92a87dda15106ab54e5

Merge pull request #34278 from xedin/transitive-protocol-inference [CSBindings] Implement transtive protocol requirement inference

view details

Pavel Yaskevich

commit sha 340d1e843a43663c71119019e05fa0691034be1a

[ConstraintSystem] Record trailing choice match choice when arguments/result are equivalent to applied function

view details

Joe Groff

commit sha aef8f503d88a12dec047c4e3a6383bf8f0cb6d51

Merge pull request #34210 from jckarter/async-await-sil-verifier SIL: Verify invariants of async_continuation instructions.

view details

swift-ci

commit sha b654008443990552d87c9600bde87e3a642c3808

Merge pull request #34337 from nathawes/allow-missing-args-when-type-checking-for-completion

view details

Pavel Yaskevich

commit sha a0a37d2a713731c22e2e0f9c39f817943aeae97c

Merge pull request #34356 from xedin/record-trailing-even-if-types-are-equal [ConstraintSystem] Record trailing choice match choice when arguments…

view details

push time in 9 days

push eventapple/swift

Slava Pestov

commit sha c39bb8970a85c5e5a12c69ff52d4b7216b81aea8

Add regression test for https://bugs.swift.org/browse/SR-8456

view details

Slava Pestov

commit sha 50e6ae08bad884e22df39247c63474cfe54dc8a3

Merge pull request #34353 from slavapestov/regression-test-sr-8456 Add regression test for https://bugs.swift.org/browse/SR-8456

view details

push time in 10 days

push eventapple/swift

Slava Pestov

commit sha 6a5684a76c424af9a86ef3c6893ed7428899092f

Sema: Allow duplicate internal parameter names on protocol requirements This fixes a recent source compatibility regression. Fixes <rdar://problem/70445751>.

view details

Slava Pestov

commit sha c4e5233dc8248ba732d75d2ad1b36357f0e7d95b

Merge pull request #34352 from slavapestov/local-redeclaration-check-source-compat Sema: Allow duplicate internal parameter names on protocol requirements

view details

push time in 10 days

PR merged apple/swift

Sema: Allow duplicate internal parameter names on protocol requirements

This fixes a recent source compatibility regression.

Fixes rdar://problem/70445751.

+30 -9

1 comment

4 changed files

slavapestov

pr closed time in 10 days

pull request commentapple/swift

Fold exportability checking into availability checking

@swift-ci Please smoke test

slavapestov

comment created time in 10 days

push eventslavapestov/swift

Slava Pestov

commit sha de29cdd75ea147d20c0d75fb3229c764ccc30fdd

Sema: Remove ExportabilityChecker Availability checking already knows how to check exportability for types and conformances referenced from inlinable function signatures and bodies. Let's generalize this to work on non-inlinable function signatures as well, allowing us to get rid of the ExportabilityChecker altogether.

view details

push time in 10 days

pull request commentapple/swift

Fold exportability checking into availability checking

@swift-ci Please test source compatibility

slavapestov

comment created time in 10 days

pull request commentapple/swift

Fold exportability checking into availability checking

@swift-ci Please smoke test

slavapestov

comment created time in 10 days

push eventslavapestov/swift

Slava Pestov

commit sha 061c05b6fb3e81dc35fe55ac50696a4efe5dadf8

Sema: Pull @_implementationOnly override checking out of ExportabilityChecker

view details

Slava Pestov

commit sha f415481281b262fa8d95de885a61ed20d1bc9b54

Sema: Refactoring in preparation for conformance availability checking Today, we check conformance exportability in two places: 1) For inlinable function bodies: in availability checking 2) For types in inlinable declaration signatures: in availability checking 3) For types in non-inlinable declaration signatures: in ExportabilityChecker I want to merge 2) and 3) together, and also generalize the conformance exportability check to check conformance availability as well. This is a preliminary refactoring towards achieving this goal.

view details

Slava Pestov

commit sha f40c71711b5081d582d783d39358a4e7726f3cc1

Sema: Don't desugar the type when diagnosing unexportable Clang function types

view details

Slava Pestov

commit sha 462bf2ab8d16586f51ef273132182a45f008331d

Sema: Remove ExportabilityChecker Availability checking already knows how to check exportability for types and conformances referenced from inlinable function signatures and bodies. Let's generalize this to work on non-inlinable function signatures as well, allowing us to get rid of the ExportabilityChecker altogether.

view details

push time in 10 days

pull request commentapple/swift

Add regression test for https://bugs.swift.org/browse/SR-8456

@swift-ci Please smoke test

slavapestov

comment created time in 10 days

create barnchslavapestov/swift

branch : regression-test-sr-8456

created branch time in 10 days

pull request commentapple/swift

Sema: Allow duplicate internal parameter names on protocol requirements

@swift-ci Please smoke test

slavapestov

comment created time in 10 days

PR opened apple/swift

Sema: Allow duplicate internal parameter names on protocol requirements

This fixes a recent source compatibility regression.

Fixes rdar://problem/70445751.

+30 -9

0 comment

4 changed files

pr created time in 10 days

create barnchslavapestov/swift

branch : local-redeclaration-check-source-compat

created branch time in 10 days

pull request commentapple/swift

Fold exportability checking into availability checking

@swift-ci Please test source compatibility

slavapestov

comment created time in 10 days

pull request commentapple/swift

Fold exportability checking into availability checking

@swift-ci Please smoke test

slavapestov

comment created time in 10 days

push eventslavapestov/swift

Butta

commit sha 69d04aad08da3245f87c6a2df35869126d48b55e

[linux] remove absolute rpath of /usr/lib/swift/linux added to many shared libraries This was presumably added as a backup, in case the libraries in a toolchain couldn't be found, but will not work well, so take it out.

view details

Arnold Schwaighofer

commit sha 18777bfa94a2eece5ab8e935d5bc539ad3483a24

LoadableByAddress: Make sure that indirect return arguments are at the right type expansion rdar://70220886

view details

Arnold Schwaighofer

commit sha b3e9a7f252019c7f0ecf008137f2ca232ac25804

Merge pull request #34324 from aschwaighofer/fix_opaque_indirect_return_results_loadable_by_address LoadableByAddress: Make sure that indirect return arguments are at the right type expansion

view details

Erik Eckstein

commit sha 007351223eb96a1a0132953a219b12d9b06ec0e7

MemBehavior: handle begin_access when checking for apply side-effects.

view details

Erik Eckstein

commit sha 68db2e7c6ce6f2bf9cdce1add556ef69971bc6a1

TempRValueOpt: don't use collectLoads in tryOptimizeStoreIntoTemp This refactoring removes a lot of special-casing in collectLoads and also makes tryOptimizeStoreIntoTemp simpler. It's a NFC.

view details

Erik Eckstein

commit sha 673b8873ab2930c0497944411a28070877883591

TempRValueOpt: refactoring: simplify the signature of collectLoads It's sufficient to pass the operand instead of the operand, the user and the operand value. NFC.

view details

Erik Eckstein

commit sha d569031f1a367281871ba18c92f385ffa0cafa7d

TempRValueOpt: move the mayWrite-check for applies from collectLoads to checkNoSourceModification ... where it belongs. This is mostly refactoring, but it also fixes a bug: we don't recurse into a begin_access in collectLoads. If there is an apply in such a scope, the mayWrite-check wouldn't be done. In checkNoSourceModification all instructions are visited, so the check is always done.

view details

Erik Eckstein

commit sha 7c293d8de960045fbe2d1717aa21481d801cd036

TempRValueOpt: fix the handling of begin_access Consider the related end_access instructions as uses to correctly mark the end of the lifetime of the temporary. This fixes a miscompile in case there is a modification of the copy-source between an begin_access and end_access.

view details

Erik Eckstein

commit sha 6310dfcc939d88664d1fb63a908f1139e9cf6b47

TempRValueOpt: fix the handling of load [take] load [take] was not considered as a use and it was not detected if it's in a different basic block. This fixes a miscompile in case there is a modification of the copy-source before a load [take]. rdar://problem/69757314

view details

Erik Eckstein

commit sha 9a10ec7d581345cbfcd15990c54848ca1b25dc8c

SILBuilder: add an API to insert _after_ an instruction. ... and use that API in FullApplySite::insertAfterInvocation. Also change FullApplySite::insertAfterInvocation/insertAfterFullEvaluation to directly pass a SILBuilder instead of just an insertion point to the callback. This makes more sense (given the function names) and simplifies the usages. It's a NFC.

view details

Erik Eckstein

commit sha 4557f151b1e90b874f77736bdf4ab20df8affe69

TempRValueOpt: fix the placement of destroy_addr in case of a copy_addr [take] Instead of reusing the existing destroy_addr (or load/copy_addr [take]) of the temporary, insert a new destroy_addr - at the correct location. This fixes a memory lifetime failure in case the copy-source is modified (actually: re-initialized) after the last use of the temporary: E.g. (before copy elimination): copy_addr [take] %src to [initialization] %temp %x = load %temp // last use of %temp store %y to [init] %src destroy_addr %temp The correct location for the destroy_addr is after the last use (after copy elimination): %x = load %src destroy_addr %src store %y to [init] %src rdar://problem/69757314

view details

Erik Eckstein

commit sha 262c7b251f9d650231a394bedcd5d12ca527cc92

TempRValueOpt: don't allow copy_addr [take] from a projection of the temporary. This fixes a memory lifetime failure.

view details

Erik Eckstein

commit sha 1e5f3bd253f0fbfab7f39f176f321b3dce94d11b

TempRValueOpt: only do the check for "unusual" temp object destruction in non-OSSA mode. In OSSA, memory locations are always destroyed in a "visible" way, e.g. with destroy_addr or load [take].

view details

Slava Pestov

commit sha 38c8bbd9a729f2aa09570bc51c31b92b68b7c2e2

Merge pull request #34325 from slavapestov/small-availability-fixes Small availability checking fixes

view details

Xi Ge

commit sha b9ade70c5d3f9973ba2358655912e970451b1d9b

swift_build_sdk_interfaces.py: create directory under dry-run mode Users may install a different version of SDK from the one found in the originally downloaded toolchain. Thus, we may need to create a new directory structure instead of using the original one in the toolchain, especially if the SDK under use has a different version number. rdar://67951012

view details

Luciano Almeida

commit sha 883d583a2fc6e5c74a58b379ba19a5d2907dabdd

[CSSimplify] Make sure visit and record holes recursivelly for dependent member type

view details

Luciano Almeida

commit sha 885815227f6c1321e48fa2a2300171306719c6fc

[tests] Add regression tests for SR-13732

view details

Mishal Shah

commit sha 23cde90b29bb2a0cf02dfee9fe45e7a5c36ec7b4

Update the Xcode version in How to Guides

view details

Mishal Shah

commit sha bd6cc586d5c8d826c798993e21e86477b70805db

Update the Xcode version in Getting Started doc

view details

Andrew Trick

commit sha 85ff15acd30f6b1b6e5ead370ec9d99e6a67b0ab

Add indexTrieRoot to the SILModule to share across Analyses. ...and avoid reallocation. This is immediately necessary for LICM, in addition to its current uses. I suspect this could be used by many passes that work with addresses. RLE/DSE should absolutely migrate to it.

view details

push time in 10 days

push eventapple/swift

Slava Pestov

commit sha 5d6cf5cd96deab6f78263a09a5dd9e94cb63fe0b

Sema: Fix failure to diagnose throwing expressions inside string interpolations We need to preserve the DiagnoseErrorOnTry bit stored in the Context when exiting a ContextScope. Otherwise, we fail to produce a diagnostic if the 'try' expression pushes an intertwining Context, such as a string interpolation or 'await'. Fixes <https://bugs.swift.org/browse/SR-13654>, <rdar://problem/69958774>.

view details

Slava Pestov

commit sha 2ae0c80c1a4116836ef528060cc01e37bdfba789

Merge pull request #34340 from slavapestov/fix-effect-check-context-state Sema: Fix failure to diagnose throwing expressions inside string interpolations

view details

push time in 13 days

PR merged apple/swift

Reviewers
Sema: Fix failure to diagnose throwing expressions inside string interpolations

We need to preserve the DiagnoseErrorOnTry bit stored in the Context when exiting a ContextScope. Otherwise, we fail to produce a diagnostic if the 'try' expression pushes an intertwining Context, such as a string interpolation or 'await'.

Fixes https://bugs.swift.org/browse/SR-13654, rdar://problem/69958774.

+38 -0

1 comment

3 changed files

slavapestov

pr closed time in 13 days

pull request commentapple/swift

Sema: Fix failure to diagnose throwing expressions inside string interpolations

@swift-ci Please smoke test

slavapestov

comment created time in 13 days

PR opened apple/swift

Sema: Fix failure to diagnose throwing expressions inside string interpolations

We need to preserve the DiagnoseErrorOnTry bit stored in the Context when exiting a ContextScope. Otherwise, we fail to produce a diagnostic if the 'try' expression pushes an intertwining Context, such as a string interpolation or 'await'.

Fixes https://bugs.swift.org/browse/SR-13654, rdar://problem/69958774.

+38 -0

0 comment

3 changed files

pr created time in 13 days

create barnchslavapestov/swift

branch : fix-effect-check-context-state

created branch time in 13 days

push eventapple/swift

Slava Pestov

commit sha 1888724166059af496287d0272c21468926a3350

Sema: Disallow protocols from refining less available protocols Concrete types can conform to unavailable protocols because the witness table for the conformance is not required for use with the concrete type itself. However, protocols cannot have unavailable base protocols. I believe this was an oversight of the original implementation here.

view details

Slava Pestov

commit sha 8fd29a57cc8e829587596465ced7de6a88f7d289

Sema: Add some missing checks for where clauses on non-generic declarations Access control, availability and exportability checking missed these because of a baked-in assumption that getGenericParams() == nullptr rules out the presence of a trailing where clause.

view details

Slava Pestov

commit sha 027563733ad68846cea15034032d9d182e8a1154

AST: Disallow @available attributes on generic parameters This was a no-op and it doesn't make sense in the current model.

view details

Slava Pestov

commit sha 38c8bbd9a729f2aa09570bc51c31b92b68b7c2e2

Merge pull request #34325 from slavapestov/small-availability-fixes Small availability checking fixes

view details

push time in 13 days

PR merged apple/swift

Small availability checking fixes

A handful of problems found by inspection.

+86 -50

2 comments

7 changed files

slavapestov

pr closed time in 13 days

pull request commentapple/swift

Small availability checking fixes

@swift-ci Please smoke test

slavapestov

comment created time in 13 days

pull request commentapple/swift

Small availability checking fixes

@swift-ci Please test source compatibility

slavapestov

comment created time in 13 days

PR opened apple/swift

Fold exportability checking into availability checking

In the previous PR, I introduced DeclAvailabilityChecker. The division of labor was as follows:

  • DeclAvailabilityChecker would diagnose references to unexported types from inlinable function signatures
  • ExportabilityChecker would diagnose references to unexported types from non-inlinable function signatures
  • The existing availability check would diagnose references to unexported declarations from inlinable function bodies

This PR folds ExportabilityChecker into DeclAvailabilityChecker, merging the first two code paths, and prepares the availability checking code to look at conformance availability as well as conformance exportability.

I'm still not 100% happy with the new code I added here. In a number of places I'm passing around an ExportabilityReason/FragileFunctionKind pair. I'm loathe to introduce yet another new concept, but I think it makes sense to pair them up and call it an ExportabilityContext or similar. Once I flesh out the conformance checking logic I'll see what falls out here.

Builds upon https://github.com/apple/swift/pull/34325.

+511 -728

0 comment

15 changed files

pr created time in 13 days

create barnchslavapestov/swift

branch : nuke-exportability-checker

created branch time in 13 days

push eventslavapestov/swift

Artem Chikin

commit sha 7ce04dccf5b05f4fe64ecd50a1c6c40535a8a9eb

[Clang Importer] Set IsSystem module flag for Clang input files when precompiling a clang module This bit is important when we are pre-building system modules to be loaded later in Explicit Module Builds.

view details

Artem Chikin

commit sha faa6289d6bc0f9f613f206719fb29efec7497374

Merge pull request #34297 from artemcm/PreCompileSystemPCMs [Clang Importer] Set IsSystem module flag for Clang input files when precompiling a clang module

view details

Doug Gregor

commit sha 2a3f4f6665df9ca62381faf13b0d50e8b06acf7b

[AST] Allow resolution of the @_typeEraser type when printing.

view details

swift-ci

commit sha dd62ccd99cc13c444854fcb38ecf9737f5c2d742

Merge pull request #34326 from DougGregor/type-eraser-resolution

view details

Slava Pestov

commit sha 1888724166059af496287d0272c21468926a3350

Sema: Disallow protocols from refining less available protocols Concrete types can conform to unavailable protocols because the witness table for the conformance is not required for use with the concrete type itself. However, protocols cannot have unavailable base protocols. I believe this was an oversight of the original implementation here.

view details

Slava Pestov

commit sha 8fd29a57cc8e829587596465ced7de6a88f7d289

Sema: Add some missing checks for where clauses on non-generic declarations Access control, availability and exportability checking missed these because of a baked-in assumption that getGenericParams() == nullptr rules out the presence of a trailing where clause.

view details

Slava Pestov

commit sha 027563733ad68846cea15034032d9d182e8a1154

AST: Disallow @available attributes on generic parameters This was a no-op and it doesn't make sense in the current model.

view details

push time in 13 days

PR opened apple/swift

Small availability checking fixes

A handful of problems found by inspection.

+82 -51

0 comment

6 changed files

pr created time in 14 days

create barnchslavapestov/swift

branch : small-availability-fixes

created branch time in 14 days

pull request commentapple/swift

Disallow trailing commas when collection type sugar is parsed as exprs.

What if instead of diagnosing these expressions we left them as-is without converting to type sugar?

allevato

comment created time in 14 days

push eventapple/swift

Slava Pestov

commit sha 3d0e35e082c5f18da4a6eff30fe08706f26695fa

Sema: Remove a bit of dead code

view details

Slava Pestov

commit sha 94e999a1b55dd14284d96b60e1b67de7aae71dac

Sema: Pull availability checking out of resolveType() We used to diagnose references to unavailable declarations in two places: - inside Exprs, right after type checking the expression - inside TypeReprs, from resolveType() In broad terms, resolveType() is called with TypeReprs stored inside both Stmts and Decls. To handle the first case, I added a new overload of diagAvailability() that takes a Stmt, to be called from typeCheckStmt(). This doesn't actually walk into any Exprs stored inside the statement; this means it only walks Patterns and such. For the second case, a new DeclAvailabilityChecker is now defined in TypeCheckAccess.cpp. It's structure is analogous to the other three walkers there: - AccessControlChecker - UsableFromInlineChecker - ExportabilityChecker The new implementation of availability checking for types introduces a lot more code than the old online logic it replaces. However, I hope to consolidate some of the code duplication among the four checkers that are defined in TypeCheckAccess.cpp, and do some other cleanups that will make the benefit of the new approach apparent.

view details

Slava Pestov

commit sha baa9d7142aa1e24f4cf07672d250307e71bc90ab

Sema: Pull conformance exportability checking out of resolveType()

view details

Slava Pestov

commit sha 2a678f29dbcfd48b7ace489937e404ff68fb8f1e

Sema: Remove TypeResolutionFlags::AllowUnavailable{,Protocol}

view details

Slava Pestov

commit sha 5cebe1b8d13347786b157e03de76fd2ec760bf71

Merge pull request #34310 from slavapestov/refactor-availability-checking Sema: Pull availability checking out of resolveType()

view details

push time in 14 days

PR merged apple/swift

Reviewers
Sema: Pull availability checking out of resolveType()

We used to diagnose references to unavailable declarations in two places:

  • inside Exprs, right after type checking the expression
  • inside TypeReprs, from resolveType()

In broad terms, resolveType() is called with TypeReprs stored inside both Stmts and Decls.

To handle the first case, I added a new overload of diagAvailability() that takes a Stmt, to be called from typeCheckStmt(). This doesn't actually walk into any Exprs stored inside the statement; this means it only walks Patterns and such.

For the second case, a new DeclAvailabilityChecker is now defined in TypeCheckAccess.cpp. It's structure is analogous to the other three walkers there:

  • AccessControlChecker
  • UsableFromInlineChecker
  • ExportabilityChecker

The new implementation of availability checking for types introduces a lot more code than the old online logic it replaces. However, I hope to consolidate some of the code duplication among the four checkers that are defined in TypeCheckAccess.cpp, and do some other cleanups that will make the benefit of the new approach apparent.

+622 -169

2 comments

35 changed files

slavapestov

pr closed time in 14 days

push eventapple/swift

Slava Pestov

commit sha 5b38671b1c6f7199ee8b074a9be560517bad2b7a

sil-opt: Disable parser lookup This caught some invalid SIL in a SIL parser test.

view details

Slava Pestov

commit sha 52b847e9afbb3b1ea74837c75fbf3ba64781ee8d

Merge pull request #34318 from slavapestov/sil-opt-parser-lookup sil-opt: Disable parser lookup

view details

push time in 14 days

PR merged apple/swift

sil-opt: Disable parser lookup

This caught some invalid SIL in a SIL parser test.

+3 -2

1 comment

2 changed files

slavapestov

pr closed time in 14 days

pull request commentapple/swift

sil-opt: Disable parser lookup

@swift-ci Please smoke test

slavapestov

comment created time in 15 days

PR opened apple/swift

sil-opt: Disable parser lookup

This caught some invalid SIL in a SIL parser test.

+3 -2

0 comment

2 changed files

pr created time in 15 days

more