Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
284 commits
Select commit Hold shift + click to select a range
8912ef9
ABI/API checker: move node mapping information from under -v to under…
nkcsgexi Sep 16, 2019
c4f4485
Revert "runtime: add a workaround for Windows build"
compnerd Sep 16, 2019
387d2a9
Merge pull request #27203 from CodaFi/movin-on-up
Catfish-Man Sep 16, 2019
2f325fa
[Diagnostics] Don't store contextual type in missing argument fix/dia…
xedin Sep 16, 2019
7ff3fd1
[Test] Adds some tests
theblixguy Sep 16, 2019
0d66b0c
[AST] Fix indenation in hasValueSemantics()
theblixguy Sep 17, 2019
b234756
Merge pull request #27080 from CodaFi/can-i-have-your-autograph
CodaFi Sep 17, 2019
73871aa
Merge pull request #27200 from nkcsgexi/debug-flag
nkcsgexi Sep 17, 2019
4eb3163
Merge pull request #27202 from jckarter/opaque-type-fallback-fix
jckarter Sep 17, 2019
5a86d42
[gardening] Clean up BranchPropagatedUser.
gottesmm Sep 16, 2019
032442d
[Constant Evaluator] Add a new sil-opt pass to check constant evaluab…
ravikandhadai Sep 16, 2019
dceca2b
[ownership] Create a context structure for the linear lifetime checker.
gottesmm Sep 17, 2019
3ab346b
Merge pull request #27197 from gottesmm/pr-32d08675e348d877f893509277…
swift-ci Sep 17, 2019
c968c14
[Diagnostics] Cover single explicit tuple argument -> N parameters vi…
xedin Sep 17, 2019
0bd7621
Merge pull request #27198 from theblixguy/fix/SR-11478
theblixguy Sep 17, 2019
58459e7
[CS] Allow simplification of key path subscript arg locators (#27194)
hamishknight Sep 17, 2019
2ab5ea8
Define UnderlyingTypeRequest
CodaFi Sep 13, 2019
278ead3
Resugar the structural type
CodaFi Sep 13, 2019
dceb357
Improve the TypeAlias{Type|Decl} dump
CodaFi Sep 13, 2019
5e34169
Separate computing interface types and underlying types
CodaFi Sep 13, 2019
d0c19ed
Merge pull request #27204 from compnerd/workaround
compnerd Sep 17, 2019
4230cf7
Merge pull request #27211 from gottesmm/pr-9566688fe160ddaa5cdb741e11…
gottesmm Sep 17, 2019
d5c014b
Remove validateDeclForNameLookup
CodaFi Sep 13, 2019
c254f4d
Setting the underlying type should set the structural type too
CodaFi Sep 13, 2019
94265e8
[Frontend] Add a comment about 9e6d4db (#27169)
jrose-apple Sep 17, 2019
2a7e009
[Diagnostics] Add notes for the type_cannot_conform error that point
hborla Sep 17, 2019
4d02463
[Diagnostics] Fix `missing argument` diagnostic to support closures w…
xedin Sep 17, 2019
0aeaf7f
[Diagnostics] NFC: Remove "trailing" from method name for closures wi…
xedin Sep 17, 2019
d9c8ae4
[AST] Remove isTypeContext() check from hasValueSemantics() and move …
theblixguy Sep 17, 2019
039f67b
utils: bump to CMake 3.15.1
compnerd Sep 17, 2019
7687293
[Diagnostics] Adjust the description of existential types for the
hborla Sep 17, 2019
bf80250
Merge remote-tracking branch 'upstream/master' into type-cannot-confo…
hborla Sep 17, 2019
ea2acc6
[Test] Update Parse/confusables.swift with the "type cannot conform"
hborla Sep 17, 2019
3d058c6
[Typechecker] Remove a few unnecessary isTypeContext() checks as its …
theblixguy Sep 17, 2019
6ec62d9
Ensure that Decls aren't added needlessly before creating tree eagerly.
Sep 16, 2019
7e3608e
[ownership] Add a new checkValue overload to LinearLifetimeChecker th…
gottesmm Sep 17, 2019
5c01a11
Merge pull request #27215 from xedin/remove-fn-dep-from-missing-args
xedin Sep 17, 2019
85e6f73
[Diagnostics] In `MissingConformanceFailure`, if the non-conforming type
hborla Sep 17, 2019
3966d08
When ASTScope assertions fails, direct user to try disabling ASTScopes.
Sep 17, 2019
9a24013
Merge pull request #27219 from gottesmm/pr-76c8dc8ebfc577d7be7ce15c15…
swift-ci Sep 17, 2019
8ebba23
Add ASTScope_unreachable
Sep 17, 2019
e3f7760
Add explanations to all asserts.
Sep 17, 2019
9f642f0
Revert "Merge pull request #27203 from CodaFi/movin-on-up"
rintaro Sep 17, 2019
c99facb
Merge pull request #27057 from theblixguy/unrevert/SR-11298
theblixguy Sep 18, 2019
853caa6
[AST] Split FileUnit and its subclasses out of Module.h
jrose-apple Sep 18, 2019
8d7f1b7
[AST] Separate SourceFile from FileUnit.h
jrose-apple Sep 18, 2019
5d1a1ff
[Typechecker] Use an equal constraint between a property wrapper's va…
theblixguy Sep 18, 2019
b3d3ef3
[Test] Adds a test case
theblixguy Sep 18, 2019
6b7fbc9
Break some cycles
CodaFi Sep 18, 2019
fa5b0f3
Merge pull request #27205 from ravikandhadai/constexpr-debug-stdlib
ravikandhadai Sep 18, 2019
bcafb78
Merge pull request #27208 from ravikandhadai/constexpr-fragment-check
ravikandhadai Sep 18, 2019
54defbc
[code-completion] Remove special handling for completion on the RHS o…
Sep 17, 2019
4527711
[SyntaxParses] Address memory issue in popTokenSyntax()
rintaro Sep 18, 2019
e40759b
[SILOpt] NFC: fix -Wgnu-anonymous-struct warning
davezarzycki Sep 18, 2019
e67a90b
Merge pull request #27231 from davezarzycki/pr27231
swift-ci Sep 18, 2019
7814fdb
Merge pull request #27226 from theblixguy/fix/SR-11381
theblixguy Sep 18, 2019
1eaa767
[test] Run scale-tests on Linux too (#27223)
jrose-apple Sep 18, 2019
99859b1
Merge pull request #27214 from compnerd/bug-fixes
compnerd Sep 18, 2019
f73c4c4
Merge pull request #27225 from jrose-apple/absolute-unit
jrose-apple Sep 18, 2019
2255e81
[NFC] Replacing potentially confusing phrase "memory allocation promo…
varungandhi-apple Sep 18, 2019
29044e5
Merge pull request #27176 from hborla/type-cannot-conform-diag
hborla Sep 18, 2019
61fd4b1
[OSLog][Test] Update the new oslog overlay implementation to use
ravikandhadai Sep 16, 2019
4dac0d1
Merge pull request #27218 from nathawes/r53958454-getFixedTypeRecursi…
Sep 18, 2019
4f6951c
Change a cycle condition
CodaFi Sep 18, 2019
67c6682
Sema: Compute and store captures for default argument expressions
slavapestov Sep 17, 2019
e1e6f0e
SIL: Refactor type lowering computation of the effective generic sign…
slavapestov Sep 17, 2019
d3a4f3d
Sema: Diagnose captures of dynamic 'Self' type from default argument …
slavapestov Sep 17, 2019
b8642b0
SILGen: Fix crash when immediately-applied closure transitively captu…
slavapestov Sep 18, 2019
533d41d
SIL: Compute lowered local captures of SILDeclRefs and not AnyFunctio…
slavapestov Sep 18, 2019
78ae7ac
SILGen: Support for local function default argument captures
slavapestov Sep 18, 2019
761b029
ReflectionContext: Remove platform #ifs for image format checks.
jckarter Sep 18, 2019
1d23ebf
Merge pull request #27234 from apple/vg-sil-docs
swift-ci Sep 18, 2019
334d892
Merge pull request #27237 from jckarter/reflection-context-check-magic
jckarter Sep 18, 2019
4fcef2b
Merge pull request #27220 from slavapestov/default-arg-self-capture-d…
slavapestov Sep 18, 2019
38bde33
Merge pull request #27172 from CodaFi/aliasing-artifacts-and-noise-re…
CodaFi Sep 18, 2019
eb27a59
[NFC] Add and use ASTContext::getNSCopyingDecl()
beccadax Sep 17, 2019
1802a5c
[NFC] Note limitation of KnownProtocols
beccadax Sep 18, 2019
00ac8d8
Merge pull request #27228 from ravikandhadai/constexpr-oslog-constant…
swift-ci Sep 18, 2019
bddb2c7
[NFC] Address review feedback from #27172
CodaFi Sep 18, 2019
22861ec
[Constant Evaluator] Pass assert configuartion option to the
ravikandhadai Sep 18, 2019
d77ed7a
Merge pull request #27241 from CodaFi/well-i-should-have---run-clang-…
swift-ci Sep 19, 2019
42f350b
utils: pass `CMAKE_Swift_COMPILER`
compnerd Sep 19, 2019
f22371b
Add SIL SinkAddressProjections utility to avoid address phis.
atrick Sep 17, 2019
21426ea
[NFC] [PrintAsObjC] Don’t cache NSCopyingType
beccadax Sep 19, 2019
d0b7eca
Merge pull request #27244 from ravikandhadai/constexpr-oslog-constant…
swift-ci Sep 19, 2019
b09f875
Merge pull request #27230 from rintaro/syntaxparsse-rdar55421369
rintaro Sep 19, 2019
e2a9a43
[sil] Teach the SILVerifier how to validate that a builtin insts are …
gottesmm Sep 19, 2019
0ce2434
[NFC] Convert ClangImporter use to getNSCopyingDecl()
beccadax Sep 19, 2019
88cb02c
Merge pull request #27246 from atrick/fix-address-phi
atrick Sep 19, 2019
059b0c8
Merge pull request #27251 from gottesmm/pr-92691592fd64691bf3f49ee560…
swift-ci Sep 19, 2019
20c5dff
[builtin] Implement polymorphic builtins for all BUILTIN_BINARY_OPERA…
gottesmm Jul 11, 2019
8fab074
AST: Fix regression from SubstFlags::UseErrorTypes removal
slavapestov Sep 18, 2019
a7fce59
[SILGen] Properly substitute contextual archetypes when generating as…
DougGregor Sep 19, 2019
755dc1c
Merge pull request #27254 from gottesmm/pr-068c882956f6e9746cd2ea87e6…
gottesmm Sep 19, 2019
5e3b9b5
[cmpcodesize] Allowed args to specify dirs.
nate-chandler Sep 19, 2019
8250339
Merge pull request #27242 from slavapestov/subst-error-type-fix
slavapestov Sep 19, 2019
9c6cf45
Merge pull request #27259 from nate-chandler/cmpcodesize-can-take-bui…
nate-chandler Sep 19, 2019
4eca7aa
Merge pull request #27257 from DougGregor/silgen-sr-11303
DougGregor Sep 19, 2019
4ade7ae
[docs] CToSwift: swift_name for all top-level declarations (#27227)
jrose-apple Sep 19, 2019
74ced92
Revert "[sil] Teach the SILVerifier how to validate that a builtin in…
gottesmm Sep 19, 2019
7ce477b
Merge pull request #27262 from gottesmm/pr-f239c55c62358cc7f0c56e7588…
DougGregor Sep 20, 2019
9864cb9
[polymorphic-builtins] Teach constant folding how to fold a polymorph…
gottesmm Sep 19, 2019
80ef4c6
Merge pull request #27260 from gottesmm/pr-2b8fc4fe4ee6d645eeb2b8b243…
gottesmm Sep 20, 2019
daff289
[ClangImporter] Update old comments and remove obsolete FIXMEs
jrose-apple Sep 20, 2019
311607e
[ClangImporter] Simplify typedef bridgeability checking
jrose-apple Sep 20, 2019
a8496d4
[ClangImporter] Simplify a SmallVector fill to allocate up front
jrose-apple Sep 20, 2019
4a92e4f
[ClangImporter] Simplify helper method signature
jrose-apple Sep 20, 2019
d741075
[ClangImporter] Simplify block pointer importing ever so slightly
jrose-apple Sep 20, 2019
f919b2d
[SyntaxParse] Parse generic parameter clause and generic where clause
rintaro Sep 18, 2019
e89e010
Merge pull request #27245 from compnerd/peek-a-boo-i-see-you
compnerd Sep 20, 2019
b40509b
Update README.md
compnerd Sep 20, 2019
4804444
Merge pull request #27249 from rintaro/syntaxparse-genericparam
rintaro Sep 20, 2019
ba3a3a7
build: try harder to pass along CMAKE_Swift_COMPILER
compnerd Sep 20, 2019
22f580e
[polymorphic-builtin] Fix ASAN error.
gottesmm Sep 20, 2019
5189daa
Add a couple of crashing test cases
slavapestov Sep 19, 2019
72b61f5
[Diagnostics] Tailored diagnostic for "condition" expression
xedin Sep 10, 2019
f1cb0d1
Reflection: Make RemoteRef template not depend on Runtime.
jckarter Sep 20, 2019
f8afae9
[TypeChecker] Don't use contextual type for implicit `~=` type-check
xedin Sep 20, 2019
232185e
[Diagnostics] Don't try to diagnose immutability failures in boolean …
xedin Sep 20, 2019
1584e87
Revert "[SyntaxParse] Parse generic parameter clause and generic wher…
rintaro Sep 20, 2019
d395eb1
AST: Remove LazyResolver::resolveProtocolEnvironment()
slavapestov Sep 20, 2019
b3f4368
AST: Simplify SubstitutionMap::getProtocolSubstitutions()
slavapestov Sep 20, 2019
9a454d4
AST: Clean up ASTVerifier's archetype verification a bit
slavapestov Sep 20, 2019
542d255
AST: ProtocolConformanceRef::subst() returns an invalid conformance i…
slavapestov Sep 20, 2019
4aea875
Sema: Add a FIXME comment for a problem I found by inspection
slavapestov Sep 11, 2019
8f346a0
IDE: Pick off another usage of isConvertibleTo() with openArchetypes=…
slavapestov Sep 20, 2019
88a833f
Reflection: Move resolveRelativeField functionality onto RemoteRef
jckarter Sep 20, 2019
6f35362
Merge pull request #27278 from apple/revert-27249-syntaxparse-generic…
rintaro Sep 20, 2019
0569cbf
Revert "Revert "[SyntaxParse] Parse generic parameter clause and gene…
rintaro Sep 20, 2019
1861536
[Syntax] Fix Python lint failure
rintaro Sep 20, 2019
81c7be8
Merge pull request #27107 from xedin/if-conditional-diag
xedin Sep 20, 2019
9ec00d5
Merge pull request #27272 from gottesmm/pr-30367b8cc5c6857ca99028d097…
gottesmm Sep 20, 2019
96e023d
Merge pull request #27210 from brentdax/it-is-known
beccadax Sep 20, 2019
b32ef85
[ClangImporter] Remove workaround for old NS_ERROR_ENUM import logic …
jrose-apple Sep 20, 2019
91a5aba
Merge pull request #27268 from jrose-apple/the-hit-new-game-sim-plify
jrose-apple Sep 20, 2019
27e881d
[AST] Shrink CaptureInfo down to a PointerIntPair (#27261)
jrose-apple Sep 21, 2019
2b25fe0
[ClangImporter] Remove now-unnecessary special case for IUO importing
jrose-apple Sep 20, 2019
8eaeb51
[ConstraintSystem] Introduce a fix for assignment type mismatch
xedin Sep 20, 2019
e90a68f
[polymorphic-builtins] Teach dataflow diagnostics how to emit an erro…
gottesmm Sep 19, 2019
6c5185f
Improve diagnostic when attempting to pass an Array to a variadic arg…
owenv Jul 18, 2019
64ed0a4
stdlib: silence a unused function warning (NFC)
compnerd Sep 21, 2019
5d3e8d6
Merge pull request #27281 from rintaro/reapply-syntaxparse-genericparam
rintaro Sep 21, 2019
b11e8ac
Merge pull request #27280 from slavapestov/type-alias-sugar-prep
slavapestov Sep 21, 2019
3a93147
[ClangImporter] Remove now-unnecessary special case for IUO importing…
jrose-apple Sep 21, 2019
9d73ead
Merge pull request #27283 from xedin/assign-conversion-failures
xedin Sep 21, 2019
f0e73c8
Merge pull request #26480 from CodaFi/makes-a-nominal-decl-healthy-we…
CodaFi Sep 21, 2019
e89efa8
[parser] Fix tuple type round-tripping issue
Sep 21, 2019
92d5827
Merge pull request #27285 from compnerd/tls-conditions
swift-ci Sep 21, 2019
2df956a
Make decl shadowing ask the right question
CodaFi Sep 20, 2019
321d9b7
Remove a dead cycle check
CodaFi Sep 20, 2019
e7fccde
Directly detect the cyclic case while computing conditional requirement
CodaFi Sep 20, 2019
9913470
Merge pull request #27279 from CodaFi/eggs-tension-service
CodaFi Sep 21, 2019
f968f42
[Testing] Workaroud glibc non-null attributes
davezarzycki Sep 21, 2019
ae60618
Remove resolveExtension and validateExtension
CodaFi Sep 20, 2019
b135928
Drop CheckingWithValidSignature from the validation state machine
CodaFi Sep 20, 2019
a42bdf4
[Parse] Simplify parseIdentifierDeclName()
rintaro Sep 18, 2019
fde58a9
[ASTGen] Adjust geneate() function signatures
rintaro Sep 18, 2019
43debb4
Merge pull request #27288 from davezarzycki/pr27288
davezarzycki Sep 21, 2019
b44158c
Merge pull request #27284 from gottesmm/pr-492ee9b09850d10ed8d4b8bc54…
gottesmm Sep 21, 2019
3bbc504
Add `-no-toolchain-stdlib-rpath` flag. (#27207)
dan-zheng Sep 21, 2019
340bbe9
Merge pull request #27271 from compnerd/swift-compiler
compnerd Sep 21, 2019
7f036f4
Merge pull request #27289 from CodaFi/ah-well-on-to-the-next-one
CodaFi Sep 21, 2019
aad82fd
[NFC] Remove unnecessary validation noise
CodaFi Sep 21, 2019
768ac78
Merge pull request #27295 from CodaFi/sign-on-the-dotted-line
CodaFi Sep 21, 2019
7736009
Fix debug code
Sep 18, 2019
603cc05
WIP lazy whole scopes
Sep 19, 2019
37b16e8
Tag cycles w/ radar
Sep 19, 2019
f33c440
Push range of extension scope after type, WIP
Sep 19, 2019
80e7a1f
Remove debug code
Sep 20, 2019
b47bd97
De-experimentalify
Sep 20, 2019
87535df
Silence a warning
Sep 20, 2019
a9a9069
change compare-to-astScope-lookup to crosscheck-unqualified-lookup
Sep 20, 2019
c271dc4
Fix typo
Sep 20, 2019
c808eb5
Don't try to expand ASTSourceFileScope when eagerly building.
Sep 20, 2019
683310e
Ever expansion detection. WIP
Sep 20, 2019
c17d9ae
Radar tagging
Sep 20, 2019
ae7469b
Hacked not-so-lazy
Sep 21, 2019
6e790ea
Rm temperature
Sep 21, 2019
c7cd4ab
Fix scope test
Sep 21, 2019
3c891f9
Fully eager for printing, just eager enough for type-checking.
Sep 21, 2019
5d87a66
Ensure that after pushing start of ExtensionScope after extended type…
Sep 21, 2019
5ca1409
Add comment
Sep 22, 2019
9674643
Comment out potential debugging code issue.
Sep 22, 2019
10583f8
Ensure that reexpansion does not lose scopes.
Sep 22, 2019
7f834cd
renaming to ASTAncestor
Sep 22, 2019
b943a39
Use separate bool to record expansion
Sep 22, 2019
5144341
Count AST ancestor scopes instead of children when last expanded
Sep 22, 2019
e59196c
Remove too-restrictive assertion
Sep 22, 2019
ef570f9
cleanups
Sep 22, 2019
4166c39
Fix scope map test
Sep 23, 2019
c25de6a
Merge pull request #27221 from davidungar/A-9-17-astscope-off
Sep 23, 2019
7d2203e
Count AST ancestor scopes instead of children when last expanded
Sep 22, 2019
4a265a9
Turn on ASTScopes
Sep 23, 2019
af59279
Merge pull request #26573 from davidungar/A-7-9-astscope-no-nesting
Sep 23, 2019
a033d2b
[AST] Fix debug typo
davezarzycki Sep 23, 2019
d6a5c6f
Merge pull request #27297 from davezarzycki/pr27297
swift-ci Sep 23, 2019
079a1a4
Merge pull request #27290 from rintaro/parse-identifierdeclname-simple
rintaro Sep 23, 2019
e315b6f
Merge pull request #27291 from rintaro/syntaxparses-astgen-signature
rintaro Sep 23, 2019
8555d1b
Merge pull request #27286 from nathawes/r55280477-tuple-type-syntax-r…
rintaro Sep 23, 2019
d6c92dc
Merge pull request #27270 from apple/compnerd-tensorflow-status
shahmishal Sep 23, 2019
6f5e5e6
Fix no-asserts build.
gottesmm Sep 23, 2019
96598d8
Merge pull request #26207 from owenv/new-vararg-conversion-diag
xedin Sep 23, 2019
ebca730
Merge pull request #27274 from jckarter/detemplate-remote-ref
jckarter Sep 23, 2019
0fb5ec3
Merge pull request #27304 from gottesmm/pr-8fb189947015d45811a60087ae…
gottesmm Sep 23, 2019
b9046c6
[polymorphic-builtin] Rather than asserting in IRGen if we see a buil…
gottesmm Sep 23, 2019
bc3795e
Reflection: Remove vestigial Offset fields from ReflectionInfo
jckarter Sep 23, 2019
f086b9b
Update swift-stdlib-tool for Swift 5 (#27276)
Sep 23, 2019
33cf983
[Parse] DebuggerContextChange.h
rintaro Sep 22, 2019
c3d304c
Merge pull request #27302 from gottesmm/pr-7a861faa03ec80b01ad9a212af…
swift-ci Sep 23, 2019
a4f44fe
[ownership] Delete dead code.
gottesmm Sep 23, 2019
75315b4
Merge pull request #27312 from gottesmm/pr-7a1cedad01d914933d33a3f8d7…
swift-ci Sep 23, 2019
8d9629e
Requestify getInterfaceType() in Name Only
CodaFi Sep 23, 2019
ed18f47
Port getInterfaceType() patterns in libAST
CodaFi Sep 23, 2019
f053f9c
Port getInterfaceType() patterns in libSema
CodaFi Sep 23, 2019
792e1db
Port getInterfaceType() patterns in ancillary libraries
CodaFi Sep 23, 2019
e9bf767
[ClangImporter] Remove dead code around UnsafePointer<Void> (#27310)
jrose-apple Sep 23, 2019
3fd8481
Merge pull request #27308 from rintaro/parse-debuggercontextchange
rintaro Sep 24, 2019
1233cdf
Update SourceKit for getInterfaceType() changes
CodaFi Sep 23, 2019
860192b
[sil] Add a new helper method ApplySite::getCalleeOperand().
gottesmm Sep 23, 2019
39c202d
[sil] Add a new helper method CondBranchInst::isConditionOperand.
gottesmm Sep 23, 2019
12aa95a
[ownership] Only allow BranchPropagatedUser to be constructed from Op…
gottesmm Sep 23, 2019
c3be255
[polymorphic-builtin] Disable experimental builtin test when optimiza…
gottesmm Sep 24, 2019
b7f9130
Merge pull request #27317 from gottesmm/pr-b5717067fec005e76089cd24f7…
lorentey Sep 24, 2019
31212b8
Fix handling of null relative references in RemoteRef.
jckarter Sep 24, 2019
3e48f71
Merge pull request #27314 from CodaFi/an-interface-to-the-interface
CodaFi Sep 24, 2019
997fabb
[Type checker] Validate subscript declaration before using it.
DougGregor Sep 23, 2019
4c1fc19
Remove now-unnecessary validateDecl() call
DougGregor Sep 24, 2019
bc8dfe4
Merge pull request #27318 from jckarter/remote-ref-null-relative
jckarter Sep 24, 2019
39b960d
Update README.md
compnerd Sep 24, 2019
49179e4
Merge pull request #27324 from apple/compnerd-community-ci-status
shahmishal Sep 24, 2019
29bc645
[TBDGen] Set `installapi` flag only when building in installapi (#27315)
Sep 24, 2019
83b34ab
Merge pull request #27306 from jckarter/remove-reflection-offsets
jckarter Sep 24, 2019
50d9ab6
[NFC] Drop some unnecesary interface type forcing
CodaFi Sep 24, 2019
1a9b6d0
[SyntaxParse] Introduce CodeCompletionTypeSyntax
rintaro Sep 24, 2019
108a462
Merge pull request #27320 from DougGregor/property-wrappers-subscript…
DougGregor Sep 24, 2019
4e476ff
Merge pull request #27326 from CodaFi/interface-to-face
swift-ci Sep 24, 2019
439b911
Merge pull request #27325 from rintaro/syntaxparse-cctype
rintaro Sep 24, 2019
64bad16
Merge pull request #27316 from gottesmm/pr-634f227f60306a17bbad2b205f…
gottesmm Sep 24, 2019
b7d9475
Merge tag 'swift-DEVELOPMENT-SNAPSHOT-2019-09-24-a' into tensorflow-m…
dan-zheng Sep 25, 2019
69ab762
Applying patch from TF-815 and updating the hashes for swift-apis and…
BradLarson Sep 26, 2019
95890de
Fix test/Syntax/round_trip_parse_gen.swift.
dan-zheng Sep 27, 2019
f192f47
Workaround for test/SILOptimizer/constant_evaluable_subset_test.swift.
dan-zheng Sep 27, 2019
4e2ac10
Disable test/SILOptimizer/OSLogConstantEvaluableTest.swift.
dan-zheng Oct 1, 2019
cca9586
Merge pull request #27453 from dan-zheng/disable-test-tf-799
burmako Oct 1, 2019
e254b29
Add ASTScope support for `@differentiable` attribute. (#27451)
dan-zheng Oct 1, 2019
4d2f79b
Disable test/AutoDiff/transposing_attr_type_checking.swift. (#27454)
dan-zheng Oct 1, 2019
6476e50
Merge branch 'tensorflow' of github.com:apple/swift into tensorflow-m…
dan-zheng Oct 1, 2019
2c913b5
[tensorflow merge] fix qualified decl name parse (#27456)
Oct 1, 2019
a2243df
Update checkout for lldb.
dan-zheng Oct 1, 2019
8289b7e
Merge pull request #27455 from dan-zheng/tensorflow-merge
dan-zheng Oct 1, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
60 changes: 59 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,63 @@ CHANGELOG
Swift Next
----------

* [SR-11298][]:

A class-constrained protocol extension, where the extended protocol does
not impose a class constraint, will now infer the constraint implicitly.

```swift
protocol Foo {}
class Bar: Foo {
var someProperty: Int = 0
}

// Even though 'Foo' does not impose a class constraint, it is automatically
// inferred due to the Self: Bar constraint.
extension Foo where Self: Bar {
var anotherProperty: Int {
get { return someProperty }
// As a result, the setter is now implicitly nonmutating, just like it would
// be if 'Foo' had a class constraint.
set { someProperty = newValue }
}
}
```

As a result, this could lead to code that currently compiles today to throw an error.

```swift
protocol Foo {
var someProperty: Int { get set }
}

class Bar: Foo {
var someProperty = 0
}

extension Foo where Self: Bar {
var anotherProperty1: Int {
get { return someProperty }
// This will now error, because the protocol requirement
// is implicitly mutating and the setter is implicitly
// nonmutating.
set { someProperty = newValue } // Error
}
}
```

**Workaround**: Define a new mutable variable inside the setter that has a reference to `self`:

```swift
var anotherProperty1: Int {
get { return someProperty }
set {
var mutableSelf = self
mutableSelf.someProperty = newValue // Okay
}
}
```

* [SE-0253][]:

Values of types that declare `func callAsFunction` methods can be called
Expand All @@ -51,7 +108,7 @@ Swift Next

* [SR-4206][]:

A method override is no longer allowed to have a generic signature with
A method override is no longer allowed to have a generic signature with
requirements not imposed by the base method. For example:

```
Expand Down Expand Up @@ -7765,3 +7822,4 @@ Swift 1.0
[SR-8974]: <https://bugs.swift.org/browse/SR-8974>
[SR-9043]: <https://bugs.swift.org/browse/SR-9043>
[SR-9827]: <https://bugs.swift.org/browse/SR-9827>
[SR-11298]: <https://bugs.swift.org/browse/SR-11298>
3 changes: 3 additions & 0 deletions cmake/modules/SwiftHandleGybSources.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,13 @@ function(handle_gyb_sources dependency_out_var_name sources_var_name arch)
"${SWIFT_SOURCE_DIR}/utils/gyb_syntax_support/AttributeNodes.py"
"${SWIFT_SOURCE_DIR}/utils/gyb_syntax_support/AvailabilityNodes.py"
"${SWIFT_SOURCE_DIR}/utils/gyb_syntax_support/CommonNodes.py"
"${SWIFT_SOURCE_DIR}/utils/gyb_syntax_support/CompletionOnlyNodes.py"
"${SWIFT_SOURCE_DIR}/utils/gyb_syntax_support/DeclNodes.py"
"${SWIFT_SOURCE_DIR}/utils/gyb_syntax_support/ExprNodes.py"
"${SWIFT_SOURCE_DIR}/utils/gyb_syntax_support/GenericNodes.py"
"${SWIFT_SOURCE_DIR}/utils/gyb_syntax_support/NodeSerializationCodes.py"
"${SWIFT_SOURCE_DIR}/utils/gyb_syntax_support/PatternNodes.py"
"${SWIFT_SOURCE_DIR}/utils/gyb_syntax_support/SILOnlyNodes.py"
"${SWIFT_SOURCE_DIR}/utils/gyb_syntax_support/StmtNodes.py"
"${SWIFT_SOURCE_DIR}/utils/gyb_syntax_support/TypeNodes.py"
"${SWIFT_SOURCE_DIR}/utils/gyb_syntax_support/Token.py"
Expand Down
206 changes: 205 additions & 1 deletion docs/CToSwiftNameTranslation.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Name Translation from C to Swift

This document gives a high-level description of how C and Objective-C declarations are translated to Swift, with particular focus on how names are adjusted. It is not attempting to be a *complete* description of everything the compiler does except with regards to how *names* are transformed; even there, some special cases that only apply to Apple's SDKs have been omitted.
This document gives a high-level description of how C and Objective-C declarations are translated to Swift, with particular focus on how names are adjusted. It is not attempting to be a *complete* description of everything the compiler does except with regards to how *names* are transformed; even there, some special cases that only apply to Apple's SDKs have been omitted. The example code shown is for illustrative purposes and does not always include all parts of an imported API's interface.

## Word boundaries

Expand Down Expand Up @@ -239,4 +239,208 @@ _The original intent of the `swift_private` attribute was additionally to limit
_For "historical reasons", the `swift_private` attribute is ignored on factory methods with no arguments imported as initializers. This is essentially matching the behavior of older Swift compilers for source compatibility in case someone has marked such a factory method as `swift_private`._


## Custom names

The `swift_name` Clang attribute can be used to control how a declaration imports into Swift. If it's valid, the value of the `swift_name` attribute always overrides any other name transformation rules (prefix-stripping, underscore-prepending, etc.)

### Types and globals

The `swift_name` attribute can be used to give a type or a global a custom name. In the simplest form, the value of the attribute must be a valid Swift identifier.

```objc
__attribute__((swift_name("SpacecraftCoordinates")))
struct SPKSpacecraftCoordinates {
double x, y, z, t; // space and time, of course
};
```

```swift
struct SpacecraftCoordinates {
var x, y, z, t: Double
}
```

### Import-as-member

A custom name that starts with an identifier followed by a period is taken to be a member name. The identifier should be the imported Swift name of a C/Objective-C type in the same module. In this case, the type or global will be imported as a static member of the named type.

```objc
__attribute__((swift_name("SpacecraftCoordinates.earth")))
extern const struct SPKSpacecraftCoordinates SPKSpacecraftCoordinatesEarth;
```

```swift
extension SpacecraftCoordinates {
static var earth: SpacecraftCoordinates { get }
}
```

Note that types cannot be imported as members of protocols.

_The "in the same module" restriction is considered a technical limitation; a forward declaration of the base type will work around it._


### C functions with custom names

The `swift_name` attribute can be used to give a C function a custom name. The value of the attribute must be a full Swift function name, including parameter labels.

```objc
__attribute__((swift_name("doSomething(to:bar:)")))
void doSomethingToFoo(Foo *foo, int bar);

// Usually seen as NS_SWIFT_NAME.
```

```swift
func doSomething(foo: UnsafeMutablePointer<Foo>, bar: Int32)
```

An underscore can be used in place of an empty parameter label, as in Swift.

A C function with zero arguments and a non-`void` return type can also be imported as a computed variable by using the `getter:` prefix on the name. A function with one argument and a `void` return type can optionally serve as the setter for that variable using `setter:`.

```objc
__attribute__((swift_name("getter:globalCounter()")))
int getGlobalCounter(void);
__attribute__((swift_name("setter:globalCounter(_:)")))
void setGlobalCounter(int newValue);
```

```swift
var globalCounter: Int32 { get set }
```

Note that the argument lists must still be present even though the name used is the name of the variable. (Also note the `void` parameter list to specify a C function with zero arguments. This is required!)

Variables with setters and no getters are not supported.


#### Import-as-member

Like types and globals, functions can be imported as static members of types.

```objc
__attribute__((swift_name("NSSound.beep()")))
void NSBeep(void);
```

```swift
extension NSSound {
static func beep()
}
```

However, by giving a parameter the label `self`, a function can also be imported as an instance member of a type __T__. In this case, the parameter labeled `self` must either have the type __T__ itself, or be a pointer to __T__. The latter is only valid if __T__ is imported as a value type; if the pointer is non-`const`, the resulting method will be `mutating`. If __T__ is a class, the function will be `final`.

```objc
typedef struct {
int value;
} Counter;

__attribute__((swift_name("Counter.printValue(self:)")))
void CounterPrintValue(Counter c);
__attribute__((swift_name("Counter.printValue2(self:)")))
void CounterPrintValue2(const Counter *c);
__attribute__((swift_name("Counter.resetValue(self:)")))
void CounterResetValue(Counter *c);
```

```swift
struct Counter {
var value: Int32 { get set }
}

extension Counter {
func printValue()
func printValue2()
mutating func resetValue()
}
```

This also applies to getters and setters, to be imported as instance properties.

```objc
__attribute__((swift_name("getter:Counter.absoluteValue(self:)")))
int CounterGetAbsoluteValue(Counter c);
```

```swift
extension Counter {
var absoluteValue: Int32 { get }
}
```

The getter/setter syntax also allows for subscripts by using the base name `subscript`.

```objc
__attribute__((swift_name("getter:LinkedListOfInts.subscript(self:_:)")))
int LinkedListGetAtIndex(const LinkedListOfInts *head, int index);
```

```swift
extension LinkedListOfInts {
subscript(_ index: Int32) -> Int32 { get }
}
```

Finally, functions can be imported as initializers as well by using the base name `init`. These are considered "factory" initializers and are never inherited or overridable. They must not have a `self` parameter.

```objc
__attribute__((swift_name("Counter.init(initialValue:)")))
Counter CounterCreateWithInitialValue(int value);
```

```swift
extension Counter {
/* non-inherited */ init(initialValue value: Int32)
}
```


### Enumerators (enum cases)

The `swift_name` attribute can be used to rename enumerators. As mentioned above, not only does no further prefix-stripping occur on the resulting name, but the presence of a custom name removes the enum case from the computation of a prefix for the other cases.

```
// Actual example from Apple's SDKs; in fact, the first shipping example of
// swift_name on an enumerator at all!
typedef NS_ENUM(NSUInteger, NSXMLNodeKind) {
NSXMLInvalidKind = 0,
NSXMLDocumentKind,
NSXMLElementKind,
NSXMLAttributeKind,
NSXMLNamespaceKind,
NSXMLProcessingInstructionKind,
NSXMLCommentKind,
NSXMLTextKind,
NSXMLDTDKind NS_SWIFT_NAME(DTDKind),
NSXMLEntityDeclarationKind,
NSXMLAttributeDeclarationKind,
NSXMLElementDeclarationKind,
NSXMLNotationDeclarationKind
};
```

```
public enum Kind : UInt {
case invalid
case document
case element
case attribute
case namespace
case processingInstruction
case comment
case text
case DTDKind
case entityDeclaration
case attributeDeclaration
case elementDeclaration
case notationDeclaration
}
```

Although enumerators always have global scope in C, they are often imported as members in Swift, and thus the `swift_name` attribute cannot be used to import them as members of another type unless the enum type is anonymous.

_Currently, `swift_name` does not even allow importing an enum case as a member of the enum type itself, even if the enum is not recognized as an `@objc` enum, error code enum, or option set (i.e. the situation where a case is imported as a global constant)._

## More to come...
6 changes: 4 additions & 2 deletions docs/SIL.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ the Swift programming language. SIL accommodates the following use cases:
such as definitive initialization of variables and constructors, code
reachability, switch coverage.
- High-level optimization passes, including retain/release optimization,
dynamic method devirtualization, closure inlining, memory allocation promotion,
and generic function instantiation.
dynamic method devirtualization, closure inlining, promoting heap allocations
to stack allocations, promoting stack allocations to SSA registers, scalar
replacement of aggregates (splitting aggregate allocations into multiple
smaller allocations), and generic function instantiation.
- A stable distribution format that can be used to distribute "fragile"
inlineable or generic code with Swift library modules, to be optimized into
client binaries.
Expand Down
2 changes: 2 additions & 0 deletions include/swift/AST/ASTContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,8 @@ class ASTContext final {
/// Retrieve the declaration of ObjectiveC.ObjCBool.
StructDecl *getObjCBoolDecl() const;

/// Retrieve the declaration of Foundation.NSCopying.
ProtocolDecl *getNSCopyingDecl() const;
/// Retrieve the declaration of Foundation.NSError.
ClassDecl *getNSErrorDecl() const;
/// Retrieve the declaration of Foundation.NSNumber.
Expand Down
Loading