Commit Graph

39091 Commits

Author SHA1 Message Date
Anthony Latsis
a826da5979 [Sema] Fixits for assoc. type restatement hints should account for where clauses 2020-03-21 05:31:37 +03:00
swift-ci
41301c2597 Merge pull request #30542 from marcrasi/fix-autocomplete-crash-callasfunction 2020-03-20 16:57:49 -07:00
Doug Gregor
32be6f58f6 [Property wrappers] Handle composition and autoclosures.
Fixes the test case from rdar://problem/58986940.
2020-03-20 16:56:34 -07:00
Rintaro Ishizaki
0b1dbbda5f Merge pull request #30525 from rintaro/ide-completion-rdar57622639
[LookupVisibleDecls] Tweak unquialified lookup
2020-03-20 15:32:36 -07:00
Joe Groff
ee08197010 Factor appendAnyProtocolConformance out of the conformance mangling.
We want to be able to use mangled names to refer to protocol conformances in addition to type
metadata. Provide an ASTMangler method that can render an arbitrary abstract or concrete
`ProtocolConformanceRef`, factoring it out of the code used to emit conditional conformance arguments
in `appendProtocolConformance`.
2020-03-20 15:06:42 -07:00
Marc Rasi
5772ddda7e fix autocomplete crash 2020-03-20 14:43:46 -07:00
Dmitri Gribenko
eb3441075e Fix the test for importing C++ access specifiers on Windows
PR #30233 added
test/ClangImporter/access-specifiers-module-interface.swift, which
turned out to be broken on Windows. The issue is that C++ enums on
Windows have 'signed int' as the underlying type, while on macOS and
Linux the underlying type is 'unsigned int'.
2020-03-20 20:32:26 +01:00
Doug Gregor
af1abea57a [Property wrappers] Fixup SILGen test for @autoclosure support. 2020-03-20 12:21:51 -07:00
Roopesh Chander
a5f1da27d0 [Property wrappers] New tests for @autoclosure handling 2020-03-20 12:21:51 -07:00
Roopesh Chander
87443fa5fc [Property wrappers] Update existing tests for @autoclosure handling 2020-03-20 12:21:51 -07:00
Rintaro Ishizaki
80848682cc [LookupVisibleDecls] Tweak unquialified lookup
- Show static var decls in non-qualified metatype lookup
- Show enum element decls in non-qualified metatype lookup
- Never show initializers in non-qualified lookup
- Perform instance lookups in lazy var initializer
- Perform non-qualified metatype lookup inside static func

rdar://problem/57622639
2020-03-20 10:44:24 -07:00
Robert Widmann
ae9ffc842e Remove a flaky failure test
The general instability of this test across multiple platforms indicates
there are either serious problems with our dependency tracking
infrastructure, or memory corruption problems in the verifier, or both.

rdar://60689945
2020-03-20 09:52:25 -07:00
Pavel Yaskevich
d673ed0989 Merge pull request #30519 from xedin/rdar-52204414
[ConstraintSystem] Don't allow explicit closure result to be implicitly converted to `Void`
2020-03-20 09:36:17 -07:00
David Zarzycki
946f2348c4 Merge pull request #30526 from eeckstein/fix-test
tests: update sil_combine_enum.sil testfile to fix SIL parse error
2020-03-20 11:17:58 -04:00
Arnold Schwaighofer
26af2d7569 Merge pull request #30516 from aschwaighofer/silgen_fix_assign_by_wrapper_objc_dynamic
SILGen: Fix assign_by_wrapper of ``@objc dynamic`` properties
2020-03-20 06:51:39 -07:00
Erik Eckstein
a8c66cd019 tests: update sil_combine_enum.sil testfile to fix SIL parse error 2020-03-20 10:38:43 +01:00
eeckstein
70971b58e4 Merge pull request #30508 from eeckstein/combine-enum
SILCombine: optimize creating enums with tuple payloads.
2020-03-20 09:10:57 +01:00
Pavel Yaskevich
4876996b8c Merge pull request #30510 from HassanElDesouky/SR-12309-FollowUp
[CSGen] Diagnose `nil` with any number of parentheses
2020-03-20 00:13:50 -07:00
Hassan El Desouky
cdf5c5cbe3 Add more tests 2020-03-20 04:37:00 +02:00
Nathan Hawes
b3f296d590 [SourceKit/InterfaceGen] Also print the cross-import overlays of a module in its interface.
When printing the generated interface of a module, also print the decls from
any underscored cross-import overlays it is the direct, or indirect underlying
module of. Declarations are grouped by overlay, with a descriptive `MARK:`
comment introducing each overlay, and a regular comment above each decl listing
the required bystander modules that must be imported for the decl to be
available.

In addition in each overlay:
- import declarations of any underlying modules are filtered out, since they
  are either other underscored cross-import overlays, or the target module they
  are being presented as being part of.
- import declarations that are also in the target module are filtered out, since
  the overlay is being presented as a conditional part of the target module.

Resolves rdar://problem/59445385
2020-03-19 18:15:42 -07:00
Robert Widmann
589e19f7c4 Remove a missing dependency edge on Windows 2020-03-19 18:12:46 -07:00
Arnold Schwaighofer
4dec4abcd0 Merge pull request #30472 from aschwaighofer/irgen_typelayout_use_heuristic
IRGen: Only use type layouts when we expect the generated IR to be faster
2020-03-19 17:44:04 -07:00
Xi Ge
f92d2ca9d6 Merge pull request #30517 from nkcsgexi/58544718
ModuleInterface: print function-builder custom attribute only on parameters
2020-03-19 17:30:28 -07:00
Robert Widmann
ea3ef98139 Merge pull request #30302 from CodaFi/all-the-fixins
Teach the Dependency Verifier to Emit Fixits
2020-03-19 17:14:26 -07:00
Pavel Yaskevich
632e1ff142 [TypeChecker] NFC: Add a test-case for SR-12277 2020-03-19 17:00:06 -07:00
Pavel Yaskevich
89933c67da [ConstraintSystem] Don't allow explicit closure result to be implicitly converted to Void
It's allowed to convert a single statement closure from `(...) -> T` to `(...) -> Void`
_only_ if there is no explicit `return` in the body.

Resolves: [SR-12277](https://bugs.swift.org/browse/SR-12277)
Resolves: rdar://problem/52204414
2020-03-19 16:59:17 -07:00
Slava Pestov
3325cd3ab4 Merge pull request #30512 from slavapestov/curry-thunk-regression-test-again
Re-apply: Add regression test for rdar://59496033
2020-03-19 19:15:11 -04:00
Doug Gregor
ddc22a3dc3 Merge pull request #30511 from DougGregor/driver-batch-mode-disable-pch-validation
[Driver] Disable PCH validation in batch mode, too.
2020-03-19 15:48:02 -07:00
Xi Ge
b00698d977 ModuleInterface: print function-builder custom attribute only on parameters
Printing this attribute on other definitions isn't necessary.

rdar://58544718
2020-03-19 15:41:08 -07:00
Arnold Schwaighofer
57c6c59ad6 SILGen: Fix assign_by_wrapper of `@objc dynamic` properties
Insert a thunk. Objc method calls might need bridging.

rdar://60038084
2020-03-19 15:09:19 -07:00
Rintaro Ishizaki
4bd753c141 Merge pull request #30506 from rintaro/ide-completion-rdar51504896
[CodeCompletion] Don't ignore CovariantReturnConversionExpr
2020-03-19 14:57:25 -07:00
Robert Widmann
6abf057dc7 Teach the verifier to emit fixits
Emit nicely formatted fixits that contain the expectations the user should have written.
2020-03-19 14:16:53 -07:00
Xi Ge
b717fafedb Merge pull request #30509 from nkcsgexi/58562780
ModuleInterface: skip override keywords when overriding an invisible decl from super class
2020-03-19 14:11:10 -07:00
Hassan El Desouky
1844578693 Add more tests 2020-03-19 22:35:14 +02:00
Slava Pestov
a618c73b9a Re-apply: Add regression test for rdar://59496033 2020-03-19 16:23:30 -04:00
Doug Gregor
06196e09c0 Merge pull request #30496 from DougGregor/contextual-pattern-binding-decl
[Constraint system] Use the PatternBindingDecl context when possible.
2020-03-19 13:21:50 -07:00
Doug Gregor
a04260b82a [Driver] Disable PCH validation in batch mode, too.
When building in batch mode with a precompiled bridging header, tell
the frontends to disable PCH validation. We have always done this for
incremental, non-batch builds, but forgot to update this check when we
added batch mode.

Fixes SR-11986 / rdar://problem/58455465
2020-03-19 12:54:27 -07:00
Hassan El Desouky
d7dece914f Handle nil with any number of parentheses 2020-03-19 21:43:34 +02:00
Joe Groff
faec5866a4 Merge pull request #30489 from jckarter/swift-52-opaque-type-mangling
IRGen: Use mangled names to access opaque type associated types in Swift >=5.2.
2020-03-19 12:01:49 -07:00
Joe Groff
b4abd44e03 Merge pull request #30479 from jckarter/disable-mangled-name-metadata
IRGen: Add a flag to disable mangled name type metadata accessors.
2020-03-19 12:01:38 -07:00
Slava Pestov
fcf3118417 Merge pull request #30499 from slavapestov/remove-curried-declrefs
SIL: Remove curried SILDeclRefs
2020-03-19 14:59:47 -04:00
Xi Ge
75abee8f45 ModuleInterface: skip override keywords when overriding an invisible decl from super class
When we are printing Swift interface, we have to skip the override keyword
if the overriden decl is invisible from the interface. Otherwise, an error
will occur while building the Swift module because the overriding decl
doesn't override anything.

We couldn't skip every `override` keywords because they change the
ABI if the overriden decl is also publicly visible.

For public-override-internal case, having `override` doesn't have ABI
implication. Thus we can skip them.

rdar://58562780
2020-03-19 11:47:54 -07:00
Erik Eckstein
95cacf84b7 SILCombine: optimize creating enums with tuple payloads.
Convert sequences of

  %payload_addr = init_enum_data_addr %enum_addr
  %elem0_addr = tuple_element_addr %payload_addr, 0
  %elem1_addr = tuple_element_addr %payload_addr, 1
  ...
  store %payload0 to %elem0_addr
  store %payload1 to %elem1_addr
  ...
  inject_enum_addr %enum_addr, $EnumType.case

to

  %tuple = tuple (%payload0, %payload1, ...)
  %enum = enum $EnumType, $EnumType.case, %tuple
  store %enum to %enum_addr

Such patterns are generated for example when using the stdlib enumarated() function.

Part of rdar://problem/33438123
2020-03-19 19:07:11 +01:00
Rintaro Ishizaki
cbeffb69cd [CodeCompletion] Don't ignore CovariantReturnConversionExpr
in typechecked AST. This is needed to correctly get the type of the
parsed expression when the expression is a calling to a method in super
class returning 'Self'.

rdar://problem/51504896
2020-03-19 11:05:04 -07:00
Mishal Shah
cfc7adef10 Revert "Add regression test for rdar://59496033" 2020-03-19 09:31:59 -07:00
martinboehme
fa7155073d Don't import C++ class members that are protected or private (#30233)
* Don't import C++ class members that are protected or private.

We omit protected members in addition to private members because Swift
structs can't inherit from C++ classes, so there's effectively no way to
access them.

* Check access specifiers centrally in importDeclImpl().

* Fix macOS build by using <stddef.h> instead of <cstddef>.

Apparently, the macOS toolchain doesn't provide <cstddef>.

<stddef.h> is used in test/Inputs/clang-importer-sdk/usr/include/macros.h,
so I'm assuming it will be OK. (I don't unfortunately have a macOS
machine to test on.)

* Add comment explaining why we skip private and protected C++ class
members.
2020-03-19 08:20:36 -07:00
omochimetaru
3ccec26390 [Diagnostics] Fix range of fix-its in verify mode 2020-03-19 18:47:57 +09:00
Pavel Yaskevich
7fe0c86e0a Merge pull request #30495 from LucianoPAlmeida/SR-8563-ambiguous-fixed-test-case
[tests] Adding SR-8563 test cases into the suit
2020-03-19 00:08:36 -07:00
Slava Pestov
9ec80df97e SIL: Remove curried SILDeclRefs 2020-03-19 02:20:21 -04:00
Xi Ge
5fba4b3e4c Merge pull request #30484 from nkcsgexi/58563540
ModuleInterface: consider inherited protocols from super class when collecting handled protocols
2020-03-18 21:34:23 -07:00