Commit Graph

24822 Commits

Author SHA1 Message Date
Doug Gregor
9eac6fe364 [AST] Properties can be explicitly initialized via their wrapper.
The computation for "is explicitly initialized" on a pattern binding
entry didn't account for explicit initialization via the property
wrapper (e.g. @Wrapper(closure: { ... })), which lead to a crash for
properties with optional type. Fixes rdar://problem/57411331.
2019-12-02 18:03:26 -08:00
swift-ci
0dc9a0e964 Merge pull request #28519 from hamishknight/callee-as-function 2019-12-02 17:16:28 -08:00
Xi Ge
7e8ed50233 ASTMangler: use specified module names from @_originalDefinedIn to mangle symbols names
When an original module name is specified via @_originalDefinedIn attribute, we need to
use the original module name for all related runtime symbol names instead of the current
module names.

rdar://55268186
2019-12-02 16:58:31 -08:00
swift-ci
45df041c4f Merge pull request #28526 from gottesmm/pr-adc7dd569017e879cf605515924e93300c72e6d6 2019-12-02 16:18:28 -08:00
swift-ci
b544355bee Merge pull request #28525 from gottesmm/pr-026a0d4e88ada556787a0f4b3c2c9844ec67e6e1 2019-12-02 16:16:44 -08:00
Alexis Laferrière
3d9587ce0c Merge pull request #28415 from xymus/filter-by-attrs
[Serialization & ClangImporter] Filter decl to deserialize by their `@objc` attributes
2019-12-02 15:32:07 -08:00
Hamish Knight
2d7a088c91 Don't check access control for isCallableNominalType
We still want the constraint system to try looking up
a callAsFunction method even if it's inaccessible, as
we'll be able to record a fix and emit a suitable
diagnostic.
2019-12-02 15:29:22 -08:00
Hamish Knight
778e130f31 [Sema] Add TypeBase::isCallableNominalType
This checks whether a type supports being called
via callAsFunction. A request is used in order to
cache the result of this query.
2019-12-02 15:29:21 -08:00
Michael Gottesman
4c6d2f04f2 [sil] Change usages of SILArguments in SILArgument.h to use exhaustive switches over ArgumentKinds.
This will ensure we get uncovered switch warnings when we add new argument
kinds, easing adding of such arguments without introducing errors.
2019-12-02 14:44:54 -08:00
Michael Gottesman
df47eb2c1f [sil] Use SILNodes.def to define ARGKIND##ArrayRef instead of hard coding names.
I also changed all of the places that vended these to use SILNodes.def as well
so that when new argument kinds are added, things just work.
2019-12-02 14:39:02 -08:00
Hamish Knight
19e199e567 Use DefaultArgumentExpr for caller-side defaults (#28279)
Use DefaultArgumentExpr for caller-side defaults
2019-12-02 13:57:17 -08:00
Rintaro Ishizaki
5c60af3ab1 Merge pull request #28403 from rintaro/parse-skipbracedblock-adjust
[Parse] Adjust skipBracedBlock()
2019-12-02 13:44:02 -08:00
swift-ci
3ab63dd391 Merge pull request #28420 from nathawes/accessor-usrs-fix 2019-12-02 12:44:10 -08:00
Joe Groff
0926d2380b SIL: Sink GenericContextScope into IRGen.
All the context dependencies in SIL type lowering have been eradicated, but IRGen's
type info lowering is still context-dependent and doesn't systemically pass generic
contexts around. Sink GenericContextScope bookkeeping entirely into IRGen for now.
2019-12-02 12:20:05 -08:00
Joe Groff
5140174eb5 SIL: Plumb abstraction patterns through type lowering.
Lowering a SIL type should be a pure function of the formal type of a value and the
abstraction pattern it's being lowered against, but we historically did not carry
enough information in abstraction patterns to lower generic parameter types, so we
relied on a generic context signature that would be pushed and popped before lowering
interface types. This patch largely eliminates the necessity for that, by making it
so that `TypeClassifierBase` and its subclasses now take an `AbstractionPattern`
all the way down, and fixing up the visitor logic so that it derives appropriate
abstraction patterns for tuple elements, function arguments, and aggregate fields too.
This makes it so that type lowering is independent of the current generic context.
(Unfortunately, there are still places scattered across the code where we use the
current generic context in order to build abstraction patterns that we then feed
into type lowering, so we can't yet completely eliminate the concept.)

This then enables us to integrate substituted function type construction into type
lowering as well, since we can now lower a generic parameter type against an
abstraction pattern without that generic parameter having to be tied to the same
generic signature (or any generic signature at all, which in the case of a
substituted function type hasn't necessarily even been finalized yet.)
2019-12-02 12:15:56 -08:00
Alexis Laferrière
798602474b [Serialization] Clarify role of matchAttributes in FileUnit
The subclasses to FileUnit uses the functionref matchAttributes
differently, clarify how only SerializedASTFile uses the functionref to
limit deserialization work.
2019-12-02 11:58:59 -08:00
David Ungar
448d9df38c Merge pull request #28444 from davidungar/WIP-custom-diff
Fix memory violation when build record is bad.
2019-12-02 10:55:59 -08:00
swift-ci
719a93265b Merge pull request #28493 from gottesmm/pr-29cc76c7ab2ff93438398e13a6657e50a043a1ce 2019-12-01 23:32:45 -08:00
Daniel Duan
ff4ecd2e5b [include] Use nullptr instead of NULL (#28509)
NFC, gardening.
2019-12-01 23:20:10 -08:00
Michael Gottesman
37dcacf4e8 [sil] Add 'const' to SILArgument methods that are actually 'const' 2019-11-27 09:50:23 -08:00
Michael Gottesman
5d2137b4ca [gardening] Cleanup SILArgument a little bit by reorganizing the declaration.
I fixed up variable names to be camelCase, moved constructors to be right
beneath field declarations.
2019-11-27 09:50:23 -08:00
Michael Gottesman
d93eacdb95 [gardening] Remove llvm:: from references to SmallVectorImpl in SILArgument.h 2019-11-27 09:50:23 -08:00
Andrew Trick
4da33e15ad Cleanup: move ArrayPropertyOpt out of COWArrayOpt.cpp.
These are separate, mostly unrelated passes. Putting them in their own
files makes it easier to read the code, understand how to control the
passes, and makes it possible to independently trace, and debug them.
2019-11-25 11:53:49 -08:00
Saleem Abdulrasool
851f877390 Basic: default platform version to 0.0.0
The platform versions are really only used on Darwin platforms.
Simplify the path by defaulting to `0.0.0` on all platforms, and
handling the version number on supported platforms.
2019-11-24 10:12:07 -08:00
David Ungar
08cfe80061 Don't crash when asking for comparison but not incremental 2019-11-23 11:21:33 -08:00
Slava Pestov
2cada3bce1 Revert "Eagerly TypeCheck Synthesized Decls"
This reverts commit cab4e9f011.
2019-11-22 17:41:34 -05:00
Hamish Knight
6811586e40 Remove NumLookupQualifiedInAnyObject counter
We now have an equivalent counter for
AnyObjectLookupRequest.
2019-11-22 12:59:27 -08:00
Hamish Knight
256c129506 [NameLookup] Add AnyObjectLookupRequest 2019-11-22 12:59:27 -08:00
Hamish Knight
2ca30c6847 Remove NumLookupInModule counter
We now have an equivalent counter for
LookupInModuleRequest.
2019-11-22 12:59:27 -08:00
Hamish Knight
e04b56bd67 [NameLookup] Add LookupInModuleRequest 2019-11-22 12:59:26 -08:00
Varun Gandhi
1abd35a4c6 [NFC] Lift out common "canImportAsOptional" to a new header. 2019-11-22 12:43:07 -08:00
Varun Gandhi
196f358dec [AST] Add ClangTypeConverter, computing C types for FunctionTypes.
Note: The change in ASTBuilder::createFunctionType is functionally minor,
but we need the FunctionType::Params computed _before_ the ExtInfo, so we
need to shuffle a bunch of code around.
2019-11-22 12:42:36 -08:00
Varun Gandhi
8021795672 [AST] Setup AST and SIL to accomodate Clang function types.
We still don't store compute or store the type anywhere; we will do so in
later commits.
2019-11-22 12:42:08 -08:00
Andrew Trick
8052a61a56 Merge pull request #28430 from atrick/fix-existential-conformance
Fix ExistentialSpecializer: inherited conformance
2019-11-22 09:13:21 -08:00
Andrew Trick
7d0a772542 Fix ExistentialSpecializer: inherited conformance
The ExistentialSpecializer incorrectly assumed that an existential's conformances match an opened archetype. They don't. Opened archetypes strip inherited conformances per the ABI for generic argument passing. Existential values retain those inherited conformances (for some inexplicable reason).

- Rename ASTContext::getExistentialSignature() to
  getOpenedArchetypeSiganture() because it was doing exactly the wrong
  thing for existentials.

- Fix ConcreteExistentialInfo to produce the correct SubstitutionMap.

- Fix ExistentialSpecializer to generate the correct conformances for
  init_existential by adding a collectExistentialConformances() helper.

Fixes <rdar://problem/57025861> "Assertion failed: (conformances.size() == numConformanceRequirements)" in ExistentialSpecializer on inlined code
2019-11-22 01:56:20 -08:00
Rintaro Ishizaki
83f9a52cb8 Merge pull request #28362 from owenv/improve_trailing_closure_in_condition_diag_2
[Parse] Reapply trailing closure in condition fix and downgrade to warning
2019-11-22 17:05:48 +09:00
David Ungar
62ae2bfd2f Merge pull request #28164 from davidungar/WIP-custom-diff
[Incremental compilation] Source-range-based dependencies
2019-11-21 23:47:52 -08:00
Xi Ge
5a862e49bd Merge pull request #28369 from nkcsgexi/originally-defined-in-attribute
AST: introduce a new attribute @_originallyDefinedIn to the AST
2019-11-21 20:26:29 -08:00
Harlan Haskins
6f349036a9 Merge pull request #28425 from harlanhaskins/an-inconenient-init-parsing
[AST] Add attributes for hasMissingDesignatedInitializers and inheritsConvenienceInitializers
2019-11-21 17:28:09 -08:00
Xi Ge
aa1e4eec86 sema: check if @_originalDefinedIn attribute has duplicated entries for the same platform name 2019-11-21 17:04:00 -08:00
kelvin13
25e4cfc1a2 fix build failures 2019-11-21 18:47:50 -06:00
Harlan Haskins
1b24c79fe4 [AST] Add attributes for hasMissingDesignatedInitializers and inheritsConvenienceInitializers
We're planning to emit these attributes in module interfaces, but until
we land that patch, we want to parse these attributes and ignore them.

Part of rdar://51249311
2019-11-21 15:45:34 -08:00
Joe Groff
4b25b67ec0 Factor a transform visitor out of IsBindableVisitor.
For substituted function type lowering, we want to take every structural position where a
concrete type matches the original generic type in an interface, and replace it with an
independent generic parameter. The first bit, matching up structural positions to generic
parameters, is more or less what `Type::isBindableTo` already does, so we can adapt its
visitor to take a callback that optionally substitutes into the type being walked based
on the generic argument and binding in the given pair of types.
2019-11-21 15:35:12 -08:00
Nathan Hawes
77f3cb013f [Index] Fix pseudo accessor USRs generation to distinguish instance vs static accessors
It was hard-coding IsStatic to false rather than passing it through from the
VarDecl, giving the same USR for the two getters in the below:

class FixtureClass95 {
    private static var someVar: String!
    private var someVar: String!
}

Resolves rdar://problem/44531531
2019-11-21 15:11:47 -08:00
Xi Ge
7f8c04e0b7 AST: introduce a new attribute @_originallDefinedIn to the AST
We need this attribute to teach compiler to use a different name from the current
module name when generating runtime symbol names for a declaration. This is to serve
the workflow of refactoring a symbol from one library to another without breaking the existing
ABI.

This patch focuses on parsing and serializing the attribute, so @_originallyDefinedIn
will show up in AST, swiftinterface files and swiftmodule files.

rdar://55268186
2019-11-21 14:25:57 -08:00
Andrew Trick
9c04d33cdf Merge pull request #28404 from atrick/fix-escape-ispointer
EscapeAnalysis: eliminate dangling pointers.
2019-11-21 11:50:49 -08:00
David Ungar
3ff6c1c315 Merge pull request #28347 from davidungar/rdar-56946329-dynlink-filelist
[Driver] Use correct designator for filelist for dynamic link job
2019-11-21 11:31:39 -08:00
kelvin13
e4dc295d64 fix conflicts 2019-11-21 12:42:10 -06:00
Alexis Laferrière
e9abba2eab [Serialization] Filter Decl to deserialize by their attributes
Add an alternative to getTopLevelDecls and getDeclChecked to limit which
decls are deserialized by first looking at their attributes. If the
attributes are accepted by a function passed as argument the decl is
fully deserialized, otherwise it is ignored.

The filter is included in the signature of existing functions in the
Serilalization services, but I’ve added new methods for it in FileUnit
and its subclasses to leave existing implementations untouched.
2019-11-21 10:06:37 -08:00
Owen Voorhees
067a8ec42f [Parse] Downgrade trailing closure in statement condition error to a warning
In the past, this error was applied inconsistently, so diagnosing it
correctly is now a source-breaking change. Instead, diagnose it correctly,
but as a warning.
2019-11-21 08:24:46 -08:00