Commit Graph

1923 Commits

Author SHA1 Message Date
Slava Pestov
0eb2484a93 AST: Only build request dependency graph if frontend is run with -build-request-dependency-graph
This adds a measurable amount of runtime overhead, but it's only
needed for debugging.
2020-01-08 22:35:55 -05:00
Slava Pestov
652f8ee95b SIL: VTable thunks should use the 'override generic signature'
We recently added some checking to ensure that a method override's
generic signature does not have any generic requirements not
satisfied by the base method.

Loosening requirements in the other direction was allowed, because
it means the derived method can be called on potentially more types
than the base method.

However, if the generic signatures don't match, a thunk must be
emitted. While we correctly determined whether a thunk should be
emitted, the thunk had the wrong generic signature, and therefore
the wrong calling convention, which would cause crashes at runtime.

Fixes <rdar://problem/57429775>.
2020-01-08 22:19:15 -05:00
swift_jenkins
8a3c5c753b Merge remote-tracking branch 'origin/master' into master-next 2020-01-08 09:57:24 -08:00
Arnold Schwaighofer
43c24be5cd Merge remote-tracking branch 'upstream/master' into master-next 2020-01-08 06:41:34 -08:00
Varun Gandhi
afc6ccdeb5 Re-land parsing and printing for Clang function types.
This reverts commit e805fe486e, which reverted
the change earlier. The problem was caused due to a simultaneous change to some
code by the PR with parsing and printing for Clang function types (#28737)
and the PR which introduced Located<T> (#28643).

This commit also includes a small change to make sure the intersecting region
is fixed: the change is limited to using the fields of Located<T> in the
`tryParseClangType` lambda.
2020-01-07 15:58:32 -08:00
Saleem Abdulrasool
e805fe486e Revert "Clang function types v2: Electric Boogaloo (parsing + printing)" 2020-01-06 16:26:08 -08:00
Varun Gandhi
4a1a17d029 Merge pull request #28737 from varungandhi-apple/vg-v3-clang-types-in-swiftinterface
Clang function types v2: Electric Boogaloo (parsing + printing)
2020-01-06 15:42:30 -08:00
Varun Gandhi
022314a640 Merge pull request #28643 from kitaisreal/using-located-instead-of-pair
[Compiler]: Using Located<T> instead of std::pair<SourceLoc, T>
2020-01-06 14:22:29 -08:00
Varun Gandhi
7bdd72ae11 [AST] Add printing for Clang function types in SIL. 2020-01-06 13:00:04 -08:00
kelvin13
ed2552a694 fix merge conflict and update caseless stdlib enums to use synthesized Comparable 2020-01-02 18:40:50 -06:00
swift_jenkins
add386ded3 Merge remote-tracking branch 'origin/master' into master-next 2020-01-02 15:59:15 -08:00
Doug Gregor
bbcaf8c669 [Type checker] Introduce value witness constraints.
Introduce a new kind of constraint, the "value witness" constraint,
which captures a reference to a witness for a specific protocol
conformance. It otherwise acts like a more restricted form of a "value
member" constraint, where the specific member is known (as a
ValueDecl*) in advance.

The constraint is effectively dependent on the protocol
conformance itself; if that conformance fails, mark the type variables
in the resolved member type as "holes", so that the conformance
failure does not cascade.

Note that the resolved overload for this constraint always refers to
the requirement, rather than the witness, so we will end up recording
witness-method references in the AST rather than concrete references,
and leave it up to the optimizers to perform devirtualization. This is
demonstrated by the SIL changes needed in tests, and is part of the
wider resilience issue with conformances described by
rdar://problem/22708391.
2020-01-02 12:06:23 -08:00
Kita, Maksim
ea6a2dc094 SR-11889: Fixed code review issues
1. Updated Located field names with Pascal Case
2. Updated Located constuctor
3. Formatted lines with more than 80 symbols
2019-12-20 17:18:59 +03:00
Kita, Maksim
c88ac85b3f SR-11889: Fixed code review issues
1. Removed two braces {{ usage of Located initialization
2. Wrapped documentation into 80 characters
2019-12-20 17:18:59 +03:00
Kita, Maksim
b7cb3b67bf SR-11889: Using Located<T> instead of std::pair<SourceLoc, T> 2019-12-20 17:18:58 +03:00
swift_jenkins
5c9b0a8831 Merge remote-tracking branch 'origin/master' into master-next 2019-12-19 14:19:31 -08:00
swift-ci
ec0a2cae9d Merge pull request #28278 from marcrasi/ast-nondiff 2019-12-19 14:06:48 -08:00
Marc Rasi
72194c547b Merge branch 'master' into ast-nondiff 2019-12-18 17:25:09 -08:00
Brent Royal-Gordon
d0e957885f [NFC] Use CompoundDeclName for zero-arg names
Currently DeclName uses an inline representation for compound names with no argument labels. This is more compact, but it costs a spare bit that we need for other purposes. This commit switches over to representing this using a separate CompoundDeclName allocation with zero trailing argument labels instead.
2019-12-18 17:22:40 -08:00
swift_jenkins
6b53fd184c Merge remote-tracking branch 'origin/master' into master-next 2019-12-11 11:00:08 -08:00
Brent Royal-Gordon
6a8598a99c [NFC] Remove DeclNameRef staging calls 2019-12-11 00:55:18 -08:00
Brent Royal-Gordon
da88512eda [NFC] Take DeclNameRef in UnqualifiedLookup and lookupQualified() 2019-12-11 00:55:17 -08:00
Joe Groff
fb34044408 Merge remote-tracking branch 'origin/master' into master-next 2019-12-10 12:46:41 -08:00
Pavel Yaskevich
50fef73b3d Merge pull request #28580 from varungandhi-apple/vg-fix-borked-isCanonical-calc
isCanonical should take the Clang function type into account only if UseClangFunctionTypes is enabled.
2019-12-05 10:38:46 -08:00
Varun Gandhi
9d83b7d646 [Sema] Fix isCanonical calculation in FunctionType::get.
Fixes rdar://problem/57644243.
2019-12-04 18:29:11 -08:00
Varun Gandhi
e7be41d0cb Merge pull request #27479 from varungandhi-apple/vg-track-clang-function-types
Track Clang function types in the AST
2019-12-04 08:47:35 -08:00
Varun Gandhi
7a629a88df [NFC] Don't compute sizes manually in GenericFunctionType::get. 2019-11-22 12:42:38 -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
kelvin13
e4dc295d64 fix conflicts 2019-11-21 12:42:10 -06:00
swift_jenkins
54bac60067 Merge remote-tracking branch 'origin/master' into master-next 2019-11-20 11:39:19 -08:00
Slava Pestov
ef05accd31 Sema: Remove even more vestigial TypeChecker usages 2019-11-19 17:40:00 -05:00
Marc Rasi
f5677cbe42 add @nondiff to AnyFunctionType params 2019-11-14 16:49:22 -08:00
swift-ci
d9223a7d16 Merge remote-tracking branch 'origin/master' into master-next 2019-11-12 13:30:45 -08:00
Doug Gregor
fb9bee7d0b Merge pull request #28173 from CodaFi/gradual-typing
[NFC] Centralize TypeChecker Flags With TypeCheckerOptions
2019-11-12 13:19:48 -08:00
swift-ci
1f1d8f17e9 Merge remote-tracking branch 'origin/master' into master-next 2019-11-12 10:50:08 -08:00
Robert Widmann
48805b1d44 Give ASTContext TypeCheckerOptions
Strip TypeChecker of all of this state.
2019-11-12 09:56:01 -08:00
Slava Pestov
7bebb00673 AST: Small cleanup for ASTContext::getOverrideGenericSignature() 2019-11-11 23:03:27 -05:00
swift-ci
9f659177af Merge remote-tracking branch 'origin/master' into master-next 2019-11-11 14:50:04 -08:00
Robert Widmann
2f2b8afad8 Remove the list of synthesized decls"
This used to be a lot more relevant a long time ago when typeCheckFunctionsAndExternalDecls actually did type check external functions defined in C.  Now, it serves no purpose.

The validation order change from just type checking these things eagerly doesn't seem to affect anything.
2019-11-11 11:33:59 -08:00
swift-ci
8f128e0e19 Merge remote-tracking branch 'origin/master' into master-next 2019-11-07 12:49:07 -08:00
Hamish Knight
cb0c9adc46 Use getXXXType over getXXXDecl in a bunch of places 2019-11-07 08:26:08 -08:00
Hamish Knight
18088b04f0 [AST] Consolidate Obj-C types on ASTContext
This commit moves the getNSObjectType and
getObjCSelectorType methods from TypeChecker
onto ASTContext. In addition, it moves the
FOR_KNOWN_FOUNDATION_TYPES macro into a separate
file to define each of the Obj-C type decls
we want to have access to.
2019-11-07 08:26:08 -08:00
swift-ci
e64776d49e Merge remote-tracking branch 'origin/master' into master-next 2019-11-06 11:49:25 -08:00
Dan Zheng
53e61a9587 [AutoDiff upstream] Add the _Differentiation module. (#27511)
The `_Differentiation` module is the experimental support library for
differentiable programming. It is built when the build-script flag
`--enable-experimental-differentiable-programming` is enabled.

The `Differentiable` protocol generalizes all types that work with
differentiation. It is a core piece of the differentiable programming
project. Other parts depending on the `Differentiable` protocol will
be upstreamed piece by piece.

The `Differentiable` protocol is compiler-known and will be used during
type-checking, SILGen, and the SIL differentiation transform.
2019-11-06 11:31:12 -08:00
swift-ci
ecedea9231 Merge remote-tracking branch 'origin/master' into master-next 2019-11-05 22:29:55 -08:00
Robert Widmann
e907d3bc52 [NFC] Remove the TypeChecker from Typo Correction 2019-11-05 20:29:36 -08:00
swift-ci
ad3ea35608 Merge remote-tracking branch 'origin/master' into master-next 2019-11-05 20:10:09 -08:00