Commit Graph

9699 Commits

Author SHA1 Message Date
Andrew Trick
a3de97bb87 Add SILParser support for [dynamically_replaceable]. 2019-05-20 21:33:01 -07:00
David Ungar
6cf09fa9bb Merge pull request #24905 from davidungar/interpolated-string-literal-trailing-quote-loc
[NameLookup: ASTScope] Add trailing quote location to interpolated string literal.
2019-05-20 12:57:44 -07:00
Jordan Rose
e0658a3726 Merge pull request #24774 from theblixguy/fix/duplicate-tuple-labels
[Typechecker] Ban tuples with duplicate labels
2019-05-20 11:28:46 -07:00
David Ungar
e64ebadf04 Add explanation. 2019-05-20 11:22:30 -07:00
David Ungar
7a8b3c8383 Add trailing quote location to interpolated string literal. 2019-05-19 15:26:34 -07:00
Pavel Yaskevich
e76ae9c343 [ConstraintSystem] Use missing protocol fix for sequence element mismatches related to protocols 2019-05-17 14:32:04 -07:00
Jordan Rose
3b4bb1960d @_implementationOnly: fix over-eager checking for vars in extensions (#24629)
The logic I had here checked whether an extension used an
implementation-only type whenever there was a declaration within that
extension that needed checking...but unfortunately that included not
just PatternBindingDecls (whose access is filtered at a later step)
but things like IfConfigDecls (#if). Change this to only check
signatures of extensions with ABI-public members, something that is
tested once when visiting an ExtensionDecl.

Additionally, skip AccessorDecls entirely, since they'll be tested
as part of the corresponding subscript or var. This saves a duplicate
diagnostic.

rdar://problem/50541589
2019-05-16 13:13:48 -07:00
Jordan Rose
9647483aee Warn when using '@_implementationOnly' inconsistently in a module (#24800)
I thought it would be useful to allow some uses of a module to be
'@_implementationOnly' and others to not be in case someone wanted to
change from one to the other gradually, but it turns out that if
you're trying to /make/ an import implementation-only, you want to
know everywhere you used it.

rdar://problem/50748157
2019-05-16 09:13:34 -07:00
Joe Groff
d22a405e38 Merge pull request #24822 from jckarter/opaque-type-runtime-weak-link
IRGen: Weak-link opaque type entry points.
2019-05-16 07:06:36 -07:00
Pavel Yaskevich
30be693913 Merge pull request #24808 from xedin/cleaner-foreach
[TypeChecker] Simplify for ... in ... type checking
2019-05-16 00:16:46 -07:00
Joe Groff
2ade303387 IRGen: Weak-link opaque type entry points.
When backward deploying to an OS that may not have these entry points, weak-link them so that they
can be used conditionally in availability contexts that check for them.

rdar://problem/50731151
2019-05-15 20:40:54 -07:00
Joe Groff
0be95f56bd Merge pull request #24798 from jckarter/opaque-type-check-availability
Opaque types require a newer Swift runtime.
2019-05-15 18:05:40 -07:00
Jordan Rose
6caedcde57 Merge pull request #24788 from apple/command-p
Don't print extensions to conform to protocols that aren't printed

rdar://problem/50748072
2019-05-15 17:20:11 -07:00
Doug Gregor
165133e3dd Merge pull request #24799 from DougGregor/disfavored-overload-attr
Add @_disfavoredOverload attribute to affect overload resolution.
2019-05-15 16:03:28 -07:00
Suyash Srijan
935128cd3b Merge branch 'master' into fix/duplicate-tuple-labels 2019-05-15 22:38:52 +01:00
Pavel Yaskevich
1cc6f774a1 [ConstraintSystem] Improve contextual mismatch diagnostics for for ... in <expr> loop 2019-05-15 14:34:24 -07:00
swift-ci
aa6827a46d Merge pull request #24796 from ravikandhadai/oslog-optimization 2019-05-15 13:01:37 -07:00
Joe Groff
cec9e9e33a Opaque types require a newer Swift runtime.
Check the availability of decls that declare an opaque return type to ensure they deploy to a
runtime that supports opaque types.

rdar://problem/50731151
2019-05-15 11:39:53 -07:00
Xi Ge
60ee9527bb Merge pull request #24776 from nkcsgexi/digester-fix
Several swift-api-digester fixes
2019-05-15 10:55:14 -07:00
Doug Gregor
5aea1315cd Add @_disfavoredOverload attribute to affect overload resolution.
Introduce an attribute @_disfavoredOverload that can be used to state
that a particular declaration should be avoided if there is a
successful type-check for a non-@_disfavoredOverload. It's a way to
nudge overload resolution away from particular solutions.
2019-05-14 23:07:26 -07:00
Slava Pestov
c141c4807d Merge pull request #24797 from slavapestov/more-type-checked-accessors
More type checked accessors
2019-05-15 00:49:15 -04:00
Slava Pestov
86f9ca7245 AST: Add ProtocolConformanceRef::getWitnessByName() 2019-05-14 21:18:06 -04:00
Ravi Kandhadai
9be4fef53a [SIL Optimization] Add a mandatory optimization pass for optimizing
the new os log APIs based on string interpolation.
2019-05-14 18:08:59 -07:00
Brent Royal-Gordon
82928fd821 Merge pull request #24464 from brentdax/charmed-interpolations
[Parse][Sema] Improve interpolation parsing and construction
2019-05-14 17:49:46 -07:00
Slava Pestov
6e3609dc22 AST: ProtocolConformanceRef::getTypeWitnessByName() should be an instance method 2019-05-14 19:28:55 -04:00
Jordan Rose
c622f6b8dd Simplify swift::getInheritedForPrinting to take a PrintOptions
This lets us make some more assumptions in the next commit, but I
think it's also just a nice cleanup to /not/ allow random predicates
here.

There were three callers of this API:

- PrintAST, which was using PrintOptions::shouldPrint but /also/
  incorrectly notifying listeners that a declaration would be skipped.

- (IDE) Interface generation, which uses PrintOptions::shouldPrint to
  count how many "inherits" there will be.

- SwiftDocSupport's reportRelated, which does no filtering at all.
  Creating a PrintOptions here is a little more expensive, but still.

No intended functionality change.
2019-05-14 16:16:28 -07:00
Xi Ge
ae16a74af9 api-digester: diagnose adding conformances to existing protocols. rdar://48131686 2019-05-14 15:40:04 -07:00
ravikandhadai
f563212f03 Revert "[SIL Optimization] Add a mandatory pass for optimizing the new os log APIs based on string interpolation." 2019-05-14 15:11:05 -07:00
Alexis Laferrière
d4e6b58214 Merge pull request #24741 from xymus/default-definition-request
Request to lazily compute the default definition type of associated types
2019-05-14 14:17:30 -07:00
Suyash Srijan
71fee96093 [Typechecker] Ban tuples with duplicate labels 2019-05-14 19:43:46 +01:00
ravikandhadai
a6ff7bd824 Merge pull request #24336 from ravikandhadai/oslog-optimization
[SIL Optimization] Add a mandatory pass for optimizing the new os log APIs based on string interpolation.
2019-05-14 11:18:32 -07:00
Alexis Laferrière
547ba1cbef Intro a request to lazily compute default definition types
The new request, DefaultDefinitionTypeRequest, is triggered
by calling AssociatedTypeDecl::getDefaultDefinitionType.
2019-05-14 10:54:19 -07:00
Ravi Kandhadai
b7b46622aa [SIL Optimization] Add a mandatory optimization pass for optimizing
the new os log APIs based on string interpolation.
2019-05-13 19:40:39 -07:00
Jordan Rose
c506747a9c [Serialization] Drop inherited conformances on classes (#23347)
These can be recreated if needed in a client library. To do this, I've
added a new ConformanceLookupKind::NonInherited, which can also be
used elsewhere in the project where we're already filtering out
inherited conformances some other way.

Note that this doesn't drop inherited conformances from the entire
serialized interface, just from the list that a class explicitly
declares. They still get referenced sometimes.

rdar://problem/50541451 and possibly others
2019-05-13 13:41:10 -07:00
Jordan Rose
6cca050fd9 [Serialization] Retire "shadowed module" in favor of "underlying" (#24711)
Similar to 517f5d6b6a, the "shadowed" terminology didn't end up
describing the most common use of the feature; there is pretty much no
intended case where a Swift module shadows a Clang module without also
re-exporting it. Switch to "underlying", which was already in use in a
few places, and which better parallels "overlay".

No intended functionality change.
2019-05-13 10:20:03 -07:00
swift-ci
00af9c9d9a Merge pull request #22156 from Azoy/cache-money 2019-05-10 19:07:49 -07:00
Slava Pestov
37412c2de2 AST: Add ParamDecl::toFunctionParam() 2019-05-10 15:00:49 -04:00
Slava Pestov
4e3dafd9f7 AST: Remove ProtocolConformanceRef::getInheritedConformanceRef() 2019-05-10 15:00:49 -04:00
Slava Pestov
644b6adcd2 AST: Simplify ProtocolConformanceRef::getTypeWitnessByName() 2019-05-10 15:00:48 -04:00
Alexis Laferrière
9c4c30413b Merge pull request #24591 from xymus/req-sig-request
GSB: Lazy requirement signature
2019-05-10 08:47:27 -07:00
Rintaro Ishizaki
104ece8eb7 Merge pull request #24620 from rintaro/serialization-swiftonly-system-module
[Serialization] Support Swift only system module
2019-05-09 16:23:31 -07:00
Brent Royal-Gordon
4f1e05cbeb [AST] Give appendInterpolation refs a SourceLoc
This change permits UnresolvedDotExpr to have both a name and a base that are implicit, but a valid DotLoc, and to treat that DotLoc as the node’s location. It then changes the generation of string interpolation code so that `$stringInterpolation.appendInterpolation` references have a DotLoc corresponding to the backslash in the string literal.

This makes it possible for `ExprContextAnalyzer` in IDE to correctly detect when you are code-completing in a string interpolation and treat it as an `appendInterpolation` call.
2019-05-09 15:29:21 -07:00
Sam Lazarus
2309ee580a Merge pull request #24617 from sl/sl/sr-10297
Add a Diagnostic for .init calls which should be transformed into assignments (SR-10297)
2019-05-09 18:05:38 -04:00
eeckstein
8961bf1d66 Revert "Enable ExistentialSpecializer by default" 2019-05-09 13:25:51 -07:00
Alexis Laferrière
cfae7bba3d Avoid cycles when computing a requirement signature
Replace most remaining uses of isRequirementSignatureComputed by
isRequirementSignatureComputing which uses Evaluator::hasActiveRequest
to detect if the requirements are currently being computed.
2019-05-09 10:50:45 -07:00
Alexis Laferrière
3cb1b6a96f Intro Evaluator::hasActiveRequest to prevent request cycles 2019-05-09 10:46:30 -07:00
Rintaro Ishizaki
d3d30ee246 [Serialization] Support Swift only system module
Previously 'isSystemModule()' returns true only if the module is:
- Standard library
- Clang module and that is `IsSystem`
- Swift overlay for clang `IsSystem` module

Now:
- Clang module and that is `IsSystem`; or
- Swift overlay for clang `IsSystem` module
- Swift module found in either of these directories:
  - Runtime library directoris (including stdlib)
  - Frameworks in `-Fsystem` directories
  - Frameworks in `$SDKROOT/System/Library/Frameworks/` (Darwin)
  - Frameworks in `$SDKROOT/Library/Frameworks/` (Darwin)

rdar://problem/50516314
2019-05-08 17:03:06 -07:00
Alexis Laferrière
6c929273db Intro a request to compute the requirement signature of a ProtocolDecl
Replaces the explicit call to computeRequirementSignature from
validateDecl with a lazy getRequirementSignature. A side effect is that
the generic params of a ProtocolDecl are no longer computed from
validateDecl and must be computed lazily too.
2019-05-08 14:28:35 -07:00
Sam Lazarus
ad38117427 Sema: Add a diagnostic for attemting .init call on mutable value 2019-05-08 15:42:14 -04:00
Rintaro Ishizaki
acd4cb1a9d [ASTContext] Remove unused function and includes 2019-05-08 10:12:29 -07:00