Commit Graph

1145 Commits

Author SHA1 Message Date
Slava Pestov
1af01edbf0 Merge pull request #30965 from slavapestov/enable-dynamic-replacement-vs-library-evolution
Enable dynamic replacement with library evolution
2020-04-11 01:39:09 -04:00
Slava Pestov
23cac673ca IRGen: Enable dynamic replacement with library evolution
It looks like the only thing that fails is the linkage computation
for the dynamic replacement key of class methods. Even though
methods have hidden linkage to prevent them from being directly
referenced from outside a resilient module, we need to ensure
the dynamic replacement key is visible.

Fixes <rdar://problem/58457716>.
2020-04-10 22:53:36 -04:00
Xi Ge
bae31467a3 Merge pull request #30962 from nkcsgexi/44777994
AST: making `export: true` in @_specialized attribute a no-operation
2020-04-10 18:39:22 -07:00
Xi Ge
435d13496e AST: making export: true in @_specialized attribute a no-operation
The client code doesn't actually call into these specialized functions even
though they have public linkage. This could lead to TBD verification failure
shown in rdar://44777994.

This patch also warns users' codebase when `export: true` is specified.
2020-04-10 16:52:22 -07:00
Owen Voorhees
77aa5642c3 [Diagnostics] Expand test coverage of existing edu notes 2020-04-09 18:18:25 -07:00
Suyash Srijan
724f8c23db [Typechecker] Implement SE-0268 Refine didSet Semantics (#26632) 2020-04-09 01:23:15 +01:00
Ivan Smetanin
f9b1a524da Fix escaping_optional_type_argument producing behavior 2020-04-04 20:22:04 +03:00
Ivan Smetanin
5f68f7a717 Make escaping_optional_type_argument to be an error, use it instead of original message when object type is a function type 2020-04-02 18:08:19 +03:00
Ivan Smetanin
3dacbed891 Add new error diagnostic for escaping optional closures 2020-04-01 08:57:48 +03:00
Pavel Yaskevich
95be170e46 [CSApply] Support dynamic member lookup as component of key path dynamic member lookup
Previously solution application only supported references to
key path dynamic member lookup as components but it should support both kinds.

Resolves: rdar://problem/60225883
Resolves: [SR-12313](https://bugs.swift.org/browse/SR-12313)
2020-03-25 15:21:52 -07:00
Anthony Latsis
14d3687d3b [SILGen] Test vtable thunk emission for overrides with contextual where clauses 2020-03-21 05:46:47 +03:00
Pavel Yaskevich
e86558fe4f Merge pull request #30277 from LucianoPAlmeida/SR-12019-dynamically-call-generic-constraint
[SR-12019] Fix assert when dynamicallyCall parameter does not satisfy generic constraint
2020-03-10 09:12:33 -07:00
Luciano Almeida
6ca7e383a9 [tests] Add more test cases for SR-12019 dynamic callable 2020-03-08 22:56:26 -03:00
Pavel Yaskevich
a1987ec274 Merge pull request #30283 from xedin/rdar-60185506
Revert "[ConstraintSystem] Make it possible to infer subtype bindings…
2020-03-07 22:34:10 -08:00
Pavel Yaskevich
135287871b [TypeChecker] NFC: Add a test-case for rdar://problem/60185506 2020-03-07 20:37:34 -08:00
Pavel Yaskevich
0ecedfa5ea Revert "[ConstraintSystem] Make it possible to infer subtype bindings through argument conversions"
Reverts apple/swift#30006. It caused a regression that we'd like to address before re-landing:

```swift
struct X {
  var cgf: CGFloat
}

func test(x: X?) {
  let _ = (x?.cgf ?? 0) <= 0.5
}
```

This reverts commit 0a6b444b49.
This reverts commit ed255596a6.
This reverts commit 3e01160a2f.
This reverts commit 96297b7e39.

Resolves: rdar://problem/60185506
2020-03-07 20:16:56 -08:00
Luciano Almeida
c1e517a798 [tests] Adding tests for SR-12019 2020-03-07 16:52:47 -03:00
Anthony Latsis
db3f7081ec Sema: Diagnose invalid overrides involving contextual where clauses 2020-03-05 20:20:07 +03:00
Suyash Srijan
d7bba7f193 [Typechecker] Use getCalledValue() rather than using DeclRefExpr to get the function decl when checking ignored expressions (#30077) 2020-02-26 19:49:58 +00:00
Pavel Yaskevich
ed255596a6 [ConstraintSystem] Increase fix impact when get-only dynamic key path is used as a mutable one 2020-02-21 17:28:10 -08:00
Holly Borla
9f09add09b Merge pull request #29966 from hborla/type-check-type-eraser-attribute
[Sema] Implement type checking for the `_typeEraser` attribute
2020-02-21 14:12:59 -08:00
Holly Borla
e93a6b9b51 [TypeCheckAttr] Allow a typealias to be a type eraser and add additional
typeEraser tests.
2020-02-21 12:12:27 -08:00
Holly Borla
2185f431ad [TypeCheckAttr] Improve diagnostics and candidate notes for typeEraser in
the case where the type eraser has no viable initializers.
2020-02-20 12:50:04 -08:00
Holly Borla
3d18c07640 [TypeCheckAttr] Implement access control checking for the typeEraser
attribute.
2020-02-20 10:57:10 -08:00
Holly Borla
f141b4da3c [TypeCheckAttr] Provide better error messages for a typeEraser that
has invalid init candidates.
2020-02-19 21:23:57 -08:00
Holly Borla
ebb727c0a3 [TypeCheckAttr] Allow a type eraser initializer to have more than one
generic requirement.
2020-02-19 17:07:30 -08:00
Suyash Srijan
a0d3542d08 [Typechecker] Covariant subscript check must also take into consideration that there may be a type mismatch (#29828) 2020-02-15 12:52:53 +00:00
Holly Borla
c0d936ec8d [Sema] Implement type checking for the typeEraser attribute. 2020-02-14 17:47:23 -08:00
Holly Borla
ffba71b889 [Parse] Add an attribute for typeEraser.
This will be used for compiler-driven type erasure for dynamic
replacement of functions with an opaque return type. For now, just
parse the attribute and ignore it.
2020-02-11 17:30:21 -08:00
Suyash Srijan
543d649278 [Diagnostics] Warn when the result of a Void-returning function is ignored (by assigning into '_') (#29576) 2020-02-04 20:19:37 +00:00
Devin Coughlin
082421048a [AST/Sema] Add availability attributes for macCatalyst
Add a platform kind and availability attributes for macCatalyst. macCatalyst
uses iOS version numbers and inherits availability from iOS attributes unless
a macCatalyst attribute is explicitly provided.
2020-01-21 20:27:14 -08:00
Slava Pestov
b73adbe700 Driver: Actually pass -require-explicit-availability{,-target} to frontend jobs
Unless you do this, the flag has no effect when used with the driver;
it only worked in conjunction with -Xfrontend.

Noticed while working on <rdar://problem/58490723>.
2020-01-13 21:50:10 -05:00
Slava Pestov
3abf47a191 Sema: Improve -require-explicit-availability diagnostic phrasing 2020-01-13 21:49:51 -05:00
Varun Gandhi
afc6ccdeb5 Re-land parsing and printing for Clang function types.
This reverts commit e805fe486e, which reverted
the change earlier. The problem was caused due to a simultaneous change to some
code by the PR with parsing and printing for Clang function types (#28737)
and the PR which introduced Located<T> (#28643).

This commit also includes a small change to make sure the intersecting region
is fixed: the change is limited to using the fields of Located<T> in the
`tryParseClangType` lambda.
2020-01-07 15:58:32 -08:00
Saleem Abdulrasool
e805fe486e Revert "Clang function types v2: Electric Boogaloo (parsing + printing)" 2020-01-06 16:26:08 -08:00
Varun Gandhi
4a1a17d029 Merge pull request #28737 from varungandhi-apple/vg-v3-clang-types-in-swiftinterface
Clang function types v2: Electric Boogaloo (parsing + printing)
2020-01-06 15:42:30 -08:00
Varun Gandhi
afc6332289 [Sema] Parse a Clang function type from the cType argument. 2020-01-06 13:00:04 -08:00
Harlan Haskins
511db0c90a [ModuleInterface] Add printing for new attributes
Specially print @_hasMissingDesignatedInitializers and @_inheritsConvenienceInitializers in module interfaces

Fixes rdar://51249311
2020-01-06 10:15:07 -08:00
Suyash Srijan
3cda934329 [Typechecker] Fix duplicate diagnostics when using attributes (#28888)
* [Typechecker] resolveAttributedType() should invalidate the type repr after emitting a diagnostic, to prevent duplicate diagnostics later

* [Test] Update '@noescape' attribute diagnostics

* [Typechecker] Add a special diagnose method to TypeResolver that accepts a TypeRepr and invalidates it

* [Typechecker] Rename the special 'diagnose' method to 'diagnoseInvalid' for clarity
2019-12-20 19:26:50 +00:00
Frederick Kellison-Linn
71697c37ca Allow implicit self in escaping closures when self usage is unlikely to cause cycle (#23934)
* WIP implementation

* Cleanup implementation

* Install backedge rather than storing array reference

* Add diagnostics

* Add missing parameter to ResultFinderForTypeContext constructor

* Fix tests for correct fix-it language

* Change to solution without backedge, change lookup behavior

* Improve diagnostics for weak captures and captures under different names

* Remove ghosts of implementations past

* Address review comments

* Reorder member variable initialization

* Fix typos

* Exclude value types from explicit self requirements

* Add tests

* Add implementation for AST lookup

* Add tests

* Begin addressing review comments

* Re-enable AST scope lookup

* Add fixme

* Pull fix-its into a separate function

* Remove capturedSelfContext tracking from type property initializers

* Add const specifiers to arguments

* Address review comments

* Fix string literals

* Refactor implicit self diagnostics

* Add comment

* Remove trailing whitespace

* Add tests for capture list across multiple lines

* Add additional test

* Fix typo

* Remove use of ?: to fix linux build

* Remove second use of ?:

* Rework logic for finding nested self contexts
2019-12-20 02:38:41 +00:00
Xi Ge
9b599961d5 Merge pull request #28691 from nkcsgexi/tbdgen-ld-hide
TBDGen/IRGen: generate $ld$hide$os symbols for decls marked with @_originallyDefinedIn
2019-12-17 14:41:04 -08:00
Suyash Srijan
f8dace593c [Typechecker] Fix a crash related to use of invalid @autoclosure parameter 2019-12-17 03:24:09 +00:00
Suyash Srijan
66c2429cba [Typechecker] Fix a few regressions with @autoclosure (#28677)
* [Typechecker] Introduce a new request to check the structure of @autoclosure

* Revert "[Typechecker] Introduce a new request to check the structure of @autoclosure"

This reverts commit 3b1d4308bd3444230bfc7d031f7ccfa3b366a038.

* [Typechecker] Fix a few regressions related to use of @autoclosure
2019-12-17 01:07:43 +00:00
Xi Ge
03fab30ee0 Merge branch 'master' into tbdgen-ld-hide 2019-12-14 20:57:05 -08:00
Pavel Yaskevich
5ba2e59c63 Merge pull request #28752 from xedin/simplify-potential-binding
[ConstraintSystem] Record originator constraint for each type variable binding
2019-12-13 11:50:02 -08:00
Xi Ge
25376025ae IRGen: keep emitting protocol witness table symbols for refactored protocols
When Protocol P and Struct S are in a same module and S conforms to P, the protocol
witness table is emitted directly as a symbol. If we move P to a lower-level module,
the protocol witness table symbol isn't emitted, breaking users' existing executable as
a result.

This change checks whether the protocol used to be defined in the same
module and marks it as non-resilient if so. The compiler will continue
emitting witness table as symbols to maintain cross-module ABI stability.
2019-12-12 22:22:28 -08:00
Xi Ge
93a83d3f14 IRGen: reuse linker directives collected from tbd gen to emit these symbols to IR 2019-12-12 22:22:28 -08:00
Xi Ge
fdcd50628c IRGen: add a function suitable for emitting linker directive as global variable 2019-12-12 22:22:28 -08:00
Pavel Yaskevich
87beea3c40 [ConstraintSystem] Use binding as a source of type variable assignment
Since `binding` has all of the required information now it's possible
to use its `locator` as a source of type variable assignment
(`Bind` constraint) in `TypeVariableBinding::attempt` which helps
to improve diagnostics.
2019-12-12 12:42:30 -08:00
Xi Ge
6be82b35cb test: add more ABI stability test for @_originallyDefinedIn 2019-12-09 12:48:26 -08:00