Commit Graph

11880 Commits

Author SHA1 Message Date
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
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
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
Arnold Schwaighofer
75c0bf076f Merge pull request #28337 from aschwaighofer/get_type_by_mangled_name_abstract_runtime
Add swift_getTypeByMangledNameInContextInMetadataState such that we can
2019-11-21 07:37:25 -08:00
swift_jenkins
f2c5becdc7 Merge remote-tracking branch 'origin/master' into master-next 2019-11-20 16:00:01 -08:00
Robert Widmann
bed667c8e3 Merge pull request #28375 from owenv/remove-unused-diags
[Gardening] Remove unused diagnostic definitions
2019-11-20 15:46:27 -08:00
Hamish Knight
7e788b8ab9 [AST] Remove CallerDefaultArgumentExpr
Now that we use DefaultArgumentExpr for both kinds
of default arguments, this is no longer needed.
2019-11-20 15:07:33 -08:00
Hamish Knight
c667d2b361 Use DefaultArgumentExpr for caller-side defaults
This commit changes how we represent caller-side
default arguments within the AST. Instead of
directly inserting them into the call-site, use
a DefaultArgumentExpr to refer to them indirectly.

The main goal of this change is to make it such
that the expression type-checker no longer cares
about the difference between caller-side and
callee-side default arguments. In particular, it
no longer cares about whether a caller-side
default argument is well-formed when type-checking
an apply. This is important because any
conversions introduced by the default argument
shouldn't affect the score of the resulting
solution.

Instead, caller-side defaults are now lazily
type-checked when we want to emit them in SILGen.
This is done through introducing a request, and
adjusting the logic in SILGen to be more lenient
with ErrorExprs. Caller-side defaults in primary
files are still also currently checked as a part
of the declaration by `checkDefaultArguments`.

Resolves SR-11085.
Resolves rdar://problem/56144412.
2019-11-20 15:07:32 -08:00
swift_jenkins
3034aaf182 Merge remote-tracking branch 'origin/master' into master-next 2019-11-20 14:00:00 -08:00
Slava Pestov
291364b2f1 Merge pull request #28037 from zoecarver/semantics-def
Semantics attribute definition file
2019-11-20 16:42:29 -05:00
swift_jenkins
54bac60067 Merge remote-tracking branch 'origin/master' into master-next 2019-11-20 11:39:19 -08:00
Owen Voorhees
f37c1dbaea [Gardening] Remove unused diagnostic definitions 2019-11-19 19:44:37 -08:00
zoecarver
49ceefc247 Fix macro defining semantics 2019-11-19 14:45:55 -08:00
Slava Pestov
ef05accd31 Sema: Remove even more vestigial TypeChecker usages 2019-11-19 17:40:00 -05:00
zoecarver
12883d07d9 Merge branch 'master' into semantics-def 2019-11-19 13:02:47 -08:00
swift_jenkins
f69e40db09 Merge remote-tracking branch 'origin/master' into master-next 2019-11-19 09:59:26 -08:00
Nathan Hawes
7b33254b68 Merge pull request #28226 from nathawes/assertion-fixes
Fix some SourceKit assertion hits
2019-11-19 09:50:41 -08:00
David Ungar
38a6559aa9 Take path arg for comparo 2019-11-18 20:23:10 -08:00
swift_jenkins
2a8c94a938 Merge remote-tracking branch 'origin/master' into master-next 2019-11-18 18:19:58 -08:00
Robert Widmann
a5d8f7fcd3 Merge pull request #28294 from hamishknight/disqualified
[NameLookup] Add UnqualifiedLookupRequest
2019-11-18 18:15:29 -08:00
Holly Borla
eef34add12 Merge pull request #28343 from hborla/restrain-param-tuple-splat-fix
[Diagnostics] Don't apply the single parameter tuple splat fix if the parameter type is a generic parameter.
2019-11-18 18:03:51 -08:00
Holly Borla
a9a0bba31b [Diagnostics] Don't apply the single parameter tuple splat fix if the
parameter type is a generic parameter.
2019-11-18 16:19:33 -08:00
swift_jenkins
dc33d25613 Merge remote-tracking branch 'origin/master' into master-next 2019-11-18 15:19:25 -08:00
Robert Widmann
1457a6a359 Merge pull request #19876 from Kaiede/attributeBaseAlignment
Force AttributeBase Alignment to 8-byte
2019-11-18 15:07:24 -08:00
Arnold Schwaighofer
0d324d223f Add swift_getTypeByMangledNameInContextInMetadataState such that we can
use getTypeByMangledName when abstract metadata state is requested

This can significantly reduce the code size of apps constructing deeply
nested types with conditional conformances.

Requires a new runtime.

rdar://57157619
2019-11-18 14:41:35 -08:00
swift_jenkins
f919e12436 Merge remote-tracking branch 'origin/master' into master-next 2019-11-17 15:40:26 -08:00
Michael Gottesman
269762eee3 [ownership] Enable ownership lowering /after/ the diagnostic passes.
I also updated the last group of straggling tests.
2019-11-17 11:34:43 -08:00
swift_jenkins
d3729b5b76 Merge remote-tracking branch 'origin/master' into master-next 2019-11-15 20:19:52 -08:00
Harlan Haskins
26b20ef198 Merge pull request #28227 from keith/ks/remove-frozen-warning
Remove warning about @frozen without library evolution
2019-11-15 20:14:24 -08:00
Nathan Hawes
125c1fb03e [Sema] Avoid needing the typechecker for the IsStaticRequest request
It was being used purely to get the name of the type context for a diagnostic
message. SourceKit's syntactic-only requests were hitting an assertion when
this diagnostic was triggered because they don't set up a type checker.
2019-11-15 18:10:22 -08:00
David Ungar
c913ffa40e Tests the source-comparator 2019-11-15 17:26:37 -08:00
Marc Rasi
e5e25a6c71 Merge branch 'master' of github.com:apple/swift into ast-nondiff 2019-11-15 16:41:30 -08:00
Marc Rasi
1058a38abd clang-format 2019-11-15 16:37:29 -08:00
Marc Rasi
6e559ab8fa rename nondiff => noDerivative 2019-11-15 16:36:26 -08:00
Hamish Knight
2853615880 Add type to package inputs to UnqualifiedLookupRequest
This allows us use an OptionSet parameter for
the request (as currently we can't directly use it
as a parameter due to not having an == definition
for it). It also allows us to regain default
arguments for the source loc and flag parameters.
2019-11-15 16:35:14 -08:00