Commit Graph

17988 Commits

Author SHA1 Message Date
Slava Pestov
a8452b4076 AST: Fix crash in ProtocolConformance::subst() when specializing with dynamic Self
Looking up the conformance @dynamic_self C<T> : P simply returns
the normal conformance C<T> : P.

If we later apply a substitution map to the conformance to
specialize T, we would call isSpecialized() on the substituted
type, which would return false. We would then hit an assertion
because the type type @dynamic_self C<Int> is not equal to the
(erroneously unsubstituted) conformance type C<T>.

Tweak the logic slightly to avoid this.
2017-04-23 01:49:00 -07:00
Slava Pestov
c14a4be04b SILOptimizer: Don't attempt closure specialization if the callee uses dynamic Self
Currently, closure specialization inserts arguments after the 'self'
parameter, which breaks dynamic Self.

Fixes <rdar://problem/31725007>.
2017-04-23 01:49:00 -07:00
swift-ci
cce9eb4f8d Merge remote-tracking branch 'origin/master' into master-next 2017-04-23 01:48:58 -07:00
Slava Pestov
e9355f02ed Merge pull request #8338 from slavapestov/unbound-generic-fix
Small fixes for unbound generic types and related problems
2017-04-23 01:45:54 -07:00
John McCall
7b7f23ab33 Merge pull request #8945 from rjmccall/unpaired-accesses
Add unpaired access marker instructions for materializeForSet
2017-04-23 04:35:00 -04:00
Slava Pestov
07c189558c Sema: Improve the fixit for 'Self' in invalid places
In an extension of a nested type, the extended type must be
fully qualified.

Also clean up the diagnostic logic a little bit and centralize
it in diagnoseUnknownType().

Fixes <https://bugs.swift.org/browse/SR-4379>.
2017-04-23 01:10:40 -07:00
Slava Pestov
7f3c97bf8b AST: More consistent spelling of 'type alias' in diagnostics
Some messages said 'typealias' and others said 'type alias'.
Change everything to use 'type alias' consistently (except
when it's talking about the keyword itself).
2017-04-23 00:02:30 -07:00
Slava Pestov
aaca0badf9 Sema: Diagnose invalid references to type alias members of unbound generic types
Consider the following setup:

struct GenericStruct<T> {
  typealias Dependent = T
  typealias Concrete = Int
}

We have no way to model 'GenericStruct.Dependent' in the AST, so the
reference would crash. Instead, produce a diagnostic suggesting to
insert generic parameters, like 'GenericStruct<Int>.Dependent'.

The reference 'GenericStruct.Concrete' is fine though, and should
not crash; add a test that it works.

Fixes <https://bugs.swift.org/browse/SR-4390>, <rdar://problem/31480755>.
2017-04-23 00:02:30 -07:00
Slava Pestov
39b697898a Sema: Fix for unbound generic type handling
Previously we prohibited unbound generics in the underlying
type of a typealias, but due to an oversight the check was
not performed when resolving a nested type.

So this worked:

struct Outer { struct Inner<T> {} }
typealias OuterInner = Outer.Inner
let _: OuterInner<Int> = Outer.Inner<Int>()

However it was easy to cause a crash this way by stating an
unbound generic type where one was not expected. Also,
unqualified types in a typealias did not get this treatment,
so the following did not work:

typealias MyOptional = Optional

Formalize the old behavior by allowing unbound generic types
in the underlying type of a typealias, while otherwise
prohibiting unbound references to nested types.
2017-04-23 00:02:29 -07:00
swift-ci
f9243286d1 Merge remote-tracking branch 'origin/master' into master-next 2017-04-22 22:48:29 -07:00
swift-ci
b95de36096 Merge pull request #8950 from DougGregor/ibaction-31776315 2017-04-22 22:40:34 -07:00
Ted Kremenek
01e09036e1 baseAddress is optional. 2017-04-22 22:21:05 -07:00
Ted Kremenek
4aa0f46fbb Underlying Swift 3 version is now ‘3.2’ 2017-04-22 22:15:44 -07:00
Ted Kremenek
243f614552 Update test to reflect new default is -swift-version 4. 2017-04-22 22:15:30 -07:00
Ted Kremenek
81b00d46ab These tests explicitly need -swift-version 3.
These tests included sources that are
based on Swift 3.  They can be considered to be updated later to Swift 4, but it did not seem critical for what they were testing.
2017-04-22 22:15:15 -07:00
swift-ci
a0056b34ff Merge remote-tracking branch 'origin/master' into master-next 2017-04-22 21:48:40 -07:00
Doug Gregor
facf1996b1 [Clang importer] Don't transfer IBAction attributes that don't make sense.
Fixes an error emitted on declarations imported from Objective-C,
rdar://problem/31776315.
2017-04-22 21:38:23 -07:00
Slava Pestov
5bec01fd11 Merge pull request #8948 from slavapestov/nested-generics-fixes
Nested generics fixes
2017-04-22 21:35:45 -07:00
Slava Pestov
e8d58b4d4d Add test for SR-4672 which got fixed somehow 2017-04-22 20:43:26 -07:00
Roman Levenstein
a60e037c48 Revert "[sil-opened-archetype-tracker] Improve tracking of archetypes in SILBuilder" 2017-04-22 20:41:31 -07:00
Slava Pestov
9984194e3d Sema: Fix for name lookup from the where clause of a nested type extension
Normally name lookup from a where clause walks up to the parent
DeclContext, so it does not need to handle outer generic parameters
specially. But with an extension of a nested type, the outer
DeclContext is the source file, and the extension itself has a
chain of GenericParamLists linked by the OuterParameters field.
2017-04-22 20:30:36 -07:00
Arnold Schwaighofer
cafe58251e LoopUnroller: Also handle > exit condition 2017-04-22 20:04:13 -07:00
John McCall
978f0e05fe Add unpaired access marker instructions and use them to implement
dynamic access tracking in materializeForSet.
2017-04-22 22:52:13 -04:00
swift-ci
f0926d09f8 Merge remote-tracking branch 'origin/master' into master-next 2017-04-22 19:28:27 -07:00
Erik Eckstein
d2da58363d Disabled KeyPath tests, because they are failing on many bots
rdar://problem/31776015
2017-04-22 19:08:39 -07:00
Arnold Schwaighofer
533044d4c4 LoopUnroller: Teach the loop unroller about >= terminated loops 2017-04-22 17:32:37 -07:00
swift-ci
3b9c84a30c Merge remote-tracking branch 'origin/master' into master-next 2017-04-22 11:48:31 -07:00
Félix
042fccb510 Added -help option so sourcekitd-test
Added "-help" option to Options.td
Added also:
* Added "OPT_HELP" case in the main TestOptions.cpp switch. It uses the llvm options help functionality to provide up-to-date help
* Additional "Use -help for assistance" at the end of the error message that appears when calling an unknown option
Added their following tests, respectively::
* usage.swift, and
* wrong_arguments.swift

Extra: FIXME: in TestOptions::printHelp, suggesting a possible expansion for the printHelp option (details in file)
2017-04-22 15:06:48 -03:00
Roman Levenstein
33c8bde859 [sil-opened-archetype-tracker] Improve tracking of archetypes in SILBuilder
Fixes rdar://problem/31749245
2017-04-22 10:03:37 -07:00
swift-ci
b4fcbca26a Merge remote-tracking branch 'origin/master' into master-next 2017-04-21 23:29:42 -07:00
swift-ci
83908723d5 Merge pull request #8936 from DougGregor/multi-file-conformance 2017-04-21 23:12:46 -07:00
Doug Gregor
75e0bf7438 Mark conformances as "used" when the GenericSignatureBuilder needs them.
When the type checker forms a GenericSignatureBuilder to process
requirements, the GSB may look up concrete conformances. Route such
requests through TypeChecker::conformsToProtocol() so they can be
marked as used. This fixes multi-file scenarios where conformances
from another file might be used only in a generic signature in the
primary file, e.g., rdar://problem/31759258.
2017-04-21 22:55:06 -07:00
Doug Gregor
449aa2f6b4 Mark conformances as "used" when the GenericSignatureBuilder needs them.
When the type checker forms a GenericSignatureBuilder to process
requirements, the GSB may look up concrete conformances. Route such
requests through TypeChecker::conformsToProtocol() so they can be
marked as used. This fixes multi-file scenarios where conformances
from another file might be used only in a generic signature in the
primary file, e.g., rdar://problem/31759258.
2017-04-21 22:36:28 -07:00
swift-ci
6abdee2a39 Merge remote-tracking branch 'origin/master' into master-next 2017-04-21 22:08:31 -07:00
Norio Nomura
07803b1d33 [SourceKit] Apply changes made at https://github.com/apple/swift/pull/8862 also to Linux 2017-04-22 14:04:11 +09:00
Slava Pestov
fbc7858b2e Merge pull request #8911 from slavapestov/subclass-existentials-type-reconstruction
Add subclass existential support to type reconstruction
2017-04-21 21:52:35 -07:00
swift-ci
b81c9c5065 Merge remote-tracking branch 'origin/master' into master-next 2017-04-21 21:28:32 -07:00
Erik Eckstein
6fb6cdcc61 Disabled 2 driver tests because they are failing
rdar://problem/31771633
2017-04-21 21:08:33 -07:00
swift-ci
e5fa2faf8f Merge remote-tracking branch 'origin/master' into master-next 2017-04-21 20:48:31 -07:00
Andrew Bennett
ca31338e49 Simplifying implementation of ExpressibleByStringLiteral (#7125)
* Simplify conforming to ExpressibleByStringLiteral with default implementations

* attributes on default implementations

* ExpressibleByUnicodeScalarLiteral validation test

* more generic default implementations

* clean up test

* remove unneeded implementations

* remove test verification

* indent

* revert @effects and affected methods

* fix test generics with _ protocols

* Add semantic tests

* clean up tests

* Fix redundant conformance requirements
2017-04-21 20:45:28 -07:00
Slava Pestov
f025632ac2 TypeReconstruction: Fix reconstruction of type aliases 2017-04-21 20:36:32 -07:00
Slava Pestov
2aba021c6e IDE: Don't use Objective-C USRs for AnyObject
It's not a real @objc protocol.
2017-04-21 20:36:32 -07:00
Slava Pestov
3df4b90dfe TypeReconstruction: Fancier tests 2017-04-21 20:19:47 -07:00
swift-ci
4ef7b46971 Merge remote-tracking branch 'origin/master' into master-next 2017-04-21 18:08:32 -07:00
Joe Groff
3d178be169 Merge pull request #8875 from jckarter/keypaths
Keypaths
2017-04-21 17:51:17 -07:00
swift-ci
94a4e5f9e7 Merge remote-tracking branch 'origin/master' into master-next 2017-04-21 17:48:32 -07:00
Roman Levenstein
1616d1bfa4 Merge pull request #8930 from swiftix/open-existential-fixes
Bug-fix: alloc_ref object type may contain open archetypes that need to be tracked
2017-04-21 17:34:02 -07:00
Huon Wilson
84035b8bbf [SILOpt] Specialized functions are never public.
Specializations are implementation details, and thus shouldn't be
public, even if they are specializing a public function. Without this
downgrade, the ABI of a module depends on random internal code
(could change inlining decisions etc.), as well as swiftc's optimiser.
2017-04-21 16:58:00 -07:00
Arnold Schwaighofer
ba0299bf0c IRGen: Enums - Use memcpy for indirectly primitive copying fixed size types
There is no value in exploding the schema. Exploding the schema only increases
code size for large enums.

rdar://31685718
2017-04-21 16:56:53 -07:00
Joe Groff
d5cdf658da KeyPaths: Generate _kvcKeyPathString for ObjC-compatible keypaths. 2017-04-21 16:56:17 -07:00