Commit Graph

9699 Commits

Author SHA1 Message Date
Rintaro Ishizaki
6956089b0b [CodeCompletion] Complete Swift only module name after 'import'
rdar://problem/39392446
2019-05-08 10:11:52 -07:00
Slava Pestov
b103fed866 Sema: Remove old diagnostics for misplaced InOutExpr 2019-05-07 23:10:49 -04:00
Azoy
9789b2504f add typealias to known types
formatting

underscore
2019-05-07 15:13:28 -05:00
Azoy
33ed2076f6 Cache _MaxBuiltinFloatType
period
2019-05-07 14:54:48 -05:00
Doug Gregor
24d24c0e63 [AST] Allocate GenericSignature(Builders) in the arena
Opaque result type archetypes can involve type variables, which
then get introduced into GenericSignatureBuilders and the
generated GenericSignatures. Allocate them in the proper arena
So we don’t end up with use-after-free errors.

Fixes rdar://problem/50309503.
2019-05-07 06:56:42 -07:00
Ben Langmuir
a861e760e7 Merge pull request #24520 from benlangmuir/cc-crash-keypath
[code-completion] Avoid invalid member substitution for keypath dynamic lookup
2019-05-06 15:28:50 -07:00
Raj Barik
1d152fe682 Merge pull request #19820 from rajbarik/raj-es-enable
Enable ExistentialSpecializer by default
2019-05-06 13:03:28 -07:00
Brent Royal-Gordon
7311886219 Merge pull request #24334 from brentdax/wherefore-art-thou-api
[TypeChecker] Rephrase platforms in availability diagnostics
2019-05-06 11:00:03 -07:00
Ben Langmuir
34da079aa6 Pass DynamicLookupInfo through VisibleDeclConsumers NFC
This commit adds a new type DynamicLookupInfo that provides information
about how a dynamic member lookup found a particular Decl. This is
needed to correctly handle KeyPath dynamic member lookups, but for now
just plumb it through everywhere.
2019-05-06 10:02:39 -07:00
swift-ci
b16ee94d1a Merge pull request #24512 from DougGregor/property-delegates-serialization 2019-05-05 23:17:43 -07:00
Doug Gregor
eaf22c2661 [Request-evaluator] Add cacheOutput() operation to populate the cache.
Allow one to cache the output for a particular request when it is known
a priori, such as when the known result is deserialized.
2019-05-05 21:41:07 -07:00
Pavel Yaskevich
43526d031c Merge pull request #24431 from xedin/diag-noescape-param-assignment
[ConstraintSystem] Improve @escaping parameter diagnostics
2019-05-04 20:09:31 -07:00
Jordan Rose
9ba1d8a1c6 [ModuleInterface] Include the raw values of @objc enums (#24487)
...since they're part of the run-time representation. Not having this
meant that someone compiling against an interface would miscompile
uses of @objc enums defined in that interface!

rdar://problem/50410541
2019-05-04 10:14:46 -07:00
Pavel Yaskevich
164f25e86d Merge pull request #24493 from xedin/add-opaque-accessor-to-value-decl
[AST] NFC: Add `ValueDecl::getOpaqueResultTypeRepr` accessor
2019-05-03 23:12:56 -07:00
Joe Groff
22793b4567 Fixes for opaque return types on local functions.
- In Sema, don't traverse nested declarations while deducing the opaque return type. This would
  cause returns inside nested functions to clobber the return type of the outer function.
- In IRGen, walk the list of opaque return types we keep in the SourceFile already for type
  reconstruction, instead of trying to visit them ad-hoc as part of walking the AST, since
  IRGen doesn't normally walk the bodies of function decls directly.

Fixes rdar://problem/50459091
2019-05-03 16:53:21 -07:00
Pavel Yaskevich
83d6f027f5 [AST] NFC: Add ValueDecl::getOpaqueResultTypeRepr accessor
Follow-up cleanup to simplify code related to diagnosing of
opaque return type conformance mismatches.
2019-05-03 16:49:36 -07:00
Jordan Rose
517f5d6b6a [ClangImporter] Retire the term "adapter" in favor of "overlay" (#24427)
Way back in Swift 1 I was trying to draw a distinction between
"overlays", separate libraries that added Swift content to an existing
Objective-C framework, and "the Swift part of a mixed-source
framework", even though they're implemented in almost exactly the same
way. "Adapter module" was the term that covered both of those. In
practice, however, no one knew what "adapter" meant. Bring an end to
this confusion by just using "overlay" within the compiler even for
the mixed-source framework case.

No intended functionality change.
2019-05-03 11:11:58 -07:00
Joe Groff
6c779bb487 Merge pull request #24445 from jckarter/opaque-type-remote
Debugger support for opaque types.
2019-05-03 08:18:59 -07:00
Harlan Haskins
f978cb0ba3 Merge pull request #24424 from harlanhaskins/an-absolutely-remarkable-thing
[ModuleInterface] Emit remarks when rebuilding from an interface
2019-05-02 22:45:15 -07:00
Pavel Yaskevich
b6b5725969 Merge pull request #24454 from xedin/rdar-50376224
[ConstraintSystem] Detect and fix invalid refs in dynamic key path me…
2019-05-02 21:23:42 -07:00
Pavel Yaskevich
d275c8afbb [ConstraintSystem] Add a tailored diagnostic for conversion of non-escaping parameter to dependent member type 2019-05-02 21:21:58 -07:00
Harlan Haskins
dfe4491702 [ModuleInterface] Emit remarks when rebuilding from an interface
Keep track of information that led the module interface loader to reject loading a compiled module, if it needed to fall back to compiling an interface.

rdar://47792754
2019-05-02 17:46:34 -07:00
swift-ci
a97b4c88ce Merge pull request #24430 from DougGregor/property-delegates-implicit-init 2019-05-02 16:24:19 -07:00
ravikandhadai
d912e3312e Merge pull request #24113 from ravikandhadai/constexpr-skip
[Const evaluator] Add support to "skip" instructions in step-wise evaluation
2019-05-02 15:52:05 -07:00
Pavel Yaskevich
21216d8ecd [ConstraintSystem] Detect and fix invalid refs in dynamic key path member lookup
KeyPath dynamic member lookup is limited to what key path itself
could do, so let's detect and diagnose invalid references just
like we do for regular key path expressions.

Resolves: rdar://problem/50376224
2019-05-02 15:02:11 -07:00
Arnold Schwaighofer
a0892f98b4 Merge pull request #24443 from aschwaighofer/fix_circular_dependency
Fix circular dependency between SIL and AST libraries
2019-05-02 13:37:48 -07:00
Arnold Schwaighofer
52dc2e6d5b Fix circular dependency between SIL and AST libraries 2019-05-02 12:12:50 -07:00
Jordan Rose
1e5637f841 Merge pull request #24420 from jrose-apple/underpromise
[ModuleInterfaces] Warn when emitting an interface in unsupported scenarios
2019-05-02 08:59:07 -07:00
Pavel Yaskevich
62b2da803c [ConstraintSystem] Improve @escaping parameter diagnostics
Detect difference in escapiness while matching function types
in the solver and record a fix that suggests to add @escaping
attribute where appropriate.

Also emit a tailored diagnostic when non-escaping parameter
type is used as a type of a generic parameter.
2019-05-02 00:40:30 -07:00
Doug Gregor
f34aa79df1 [Property delegates] Implicit initialization for properties with delegates.
When a property delegate type has a default initializer, use that to
implicitly initialize properties that use that delegate and do not have
their own initializers. For example, this would allow (e.g.), delegate
types like the DelayedImmutable and DelayedMutable examples to drop
the explicit initialization, e.g.,

```
  @DelayedMutable var foo: Int
```

would be implicitly initialized via

```
  $foo = DelayedMutable()
```

This is a simplistic implementation that does not yet propertly handle
definite initialization.

Fixes rdar://problem/50266039.
2019-05-01 23:17:16 -07:00
Jordan Rose
3eff026bbf [ModuleInterfaces] Warn emitting without -enable-library-evolution
Module interfaces don't yet carry enough information to correctly
describe the binary interface of a module compiled without
-enable-library-evolution, but we don't want to make this an error
because that would make it harder to work towards getting it in the
future.
2019-05-01 17:32:12 -07:00
Jordan Rose
73b7185a3d [ModuleInterfaces] Warn emitting an interface in -swift-version 4[.2]
If the project ever drops Swift 4 mode or Swift 4.2 mode, that would
break modules using those modes in their interface, so put an
unsilenceable warning in for using those modes to nudge interface
emitters to Swift 5.

rdar://problem/47792595
2019-05-01 17:32:12 -07:00
Joe Groff
fc8be62895 RemoteAST: Add a request to get the underlying type from an opaque type descriptor. 2019-05-01 15:42:57 -07:00
Arnold Schwaighofer
cec1a5268e More fixes for opaque types specializer
* Opaque types are abi compatible with their substituted types
* Insert casts in more places
* Respect no optimization attribute
2019-05-01 09:31:07 -07:00
Arnold Schwaighofer
768d1c51a1 Address review feedback 2019-05-01 09:31:07 -07:00
Arnold Schwaighofer
a793dfb451 Respect resilience when specializing opaque type archetypes 2019-05-01 09:31:07 -07:00
Doug Gregor
4e86c8ff52 Merge pull request #24403 from DougGregor/constraint-solver-trailing-closure-pruning
[Constraint solver] Reject trailing closures matching non-closure-parameters
2019-05-01 06:45:24 -07:00
Doug Gregor
a1af0e45cb [Constraint solver] Reject trailing closures matching non-closure-parameters.
Enhance call-argument matching to reject trailing closures that match up
with parameters that cannot accept closures at all.

Fixes rdar://problem/50362170.
2019-04-30 23:12:32 -07:00
Brent Royal-Gordon
3494c0bd88 [TypeChecker] Rephrase platforms in availability diagnostics
This does several different things to improve how platforms are described in availability diagnostics:

• Mentions the platform in diagnostics for platform-specific @available(unavailable) attributes.
• Replaces “OS X” with “macOS”.
• Replaces “fooOS application extension” with “application extensions for fooOS”.
• Replaces “on fooOS” with “in fooOS”.

Fixes <rdar://problem/49963341>.
2019-04-30 16:32:43 -07:00
Ravi Kandhadai
b0e56f70f9 [Const evaluator] Enable stepwise constant evaluator to skip
instructions without evaluating them while conservatively accounting
for the effects of the skipped instructions on the interpreter state.
2019-04-30 15:36:29 -07:00
Alexis Laferrière
1119b91e80 Merge pull request #24204 from xymus/structural-type-request
GSB: use a request for the structural type of type aliases
2019-04-30 14:39:39 -07:00
swift-ci
ff208b677f Merge pull request #24363 from DougGregor/is-memberwise-initialized 2019-04-30 11:29:27 -07:00
Doug Gregor
96952ea9a2 [AST] Distinguish memberwise-initialized properties for storage vs. declared
The determination of whether a property is memberwise-initialized is
somewhat confused for properties that have synthesized backing properties.
Some clients (Sema/Index) want to see the declared properties, while others
(SILGen) want to see the backing stored properties. Add a flag to
`VarDecl::isMemberwiseInitialized()` to capture this variation.
2019-04-30 10:12:43 -07:00
Pavel Yaskevich
1f1e8d99d7 [Diagnostics] Improve missing conformance diagnostics for opaque return
New diagnostic framework can already identify contextual failures
related to opaque return types, `RequirementFailure` just needs
to get adjusted to identify correct affected declaration and provide
tailored diagnostic.

Resolves: rdar://problem/49582531
2019-04-29 16:17:45 -07:00
Doug Gregor
1a169b91bd Centralize the definition of isMemberwiseInitialized()
This utility was defined in Sema, used in Sema and Index, declared in
two headers, and semi- copy-pasted into SILGen. Pull it into
VarDecl::isMemberwiseInitialized() and use it consistently.
2019-04-29 10:30:38 -07:00
Slava Pestov
fa12d85739 AST: Clean up associated type default representation a bit 2019-04-26 21:47:02 -04:00
Slava Pestov
fb8bd3a056 Merge pull request #24267 from slavapestov/unused-conformances
Remove per-SourceFile "used conformances" lists
2019-04-26 18:10:28 -04:00
Saleem Abdulrasool
f88be05394 Merge pull request #24240 from compnerd/bridge-to-terabithia
WIP: bridge BOOL to Bool
2019-04-26 11:13:41 -07:00
Sam Lazarus
3d9b6396a1 Merge pull request #24059 from sl/sl/sr-10293
Allow var / let as parameter names but provide a warning and fixit to add backticks.
2019-04-26 09:30:23 -04:00
Sam Lazarus
ede8127adf Test: Add and update tests for allowing var and let as argument labels 2019-04-26 04:08:27 -04:00