Commit Graph

12606 Commits

Author SHA1 Message Date
swift-ci
41a0f6dbbd Merge pull request #7364 from DougGregor/structural-same-type 2017-02-09 15:28:13 -08:00
Doug Gregor
b412961003 [AST] Maintain type sugar in TypeMatcher. 2017-02-09 15:03:34 -08:00
swift-ci
ba466dd346 Merge pull request #7368 from eeckstein/demangle-api 2017-02-09 14:26:53 -08:00
Doug Gregor
8ccff752c5 [AST] Don't recursively match DependentMemberTypes.
Matching two dependent member types has nothing to do with matching
the bases; they're independent type parameters.
2017-02-09 14:09:19 -08:00
Doug Gregor
ae6be9fd77 [Archetype builder] Refactor same-type requirement checking slightly. 2017-02-09 14:09:18 -08:00
Erik Eckstein
479237b9ac Mangling: isSwiftSymbol should get a null terminated string rather than a char pointer + length
This avoids doing a strlen in lldb when calling this function.

rdar://problem/30062026
2017-02-09 14:05:00 -08:00
swift-ci
ec5a1c2265 Merge pull request #7367 from gottesmm/no_return_refactoring 2017-02-09 13:40:43 -08:00
Joe Shajrawi
df5297d877 Merge pull request #7349 from shajrawi/open_existential
Support for Open Existentials that do no take an address
2017-02-09 12:39:16 -08:00
swift-ci
bb874934f9 Merge pull request #7313 from huonw/requirement-signature-archetype-builder 2017-02-09 12:02:42 -08:00
Michael Gottesman
284a028e61 [sil] Add a new API SILModule::isNoReturnBuiltinOrIntrinsic(Identifier).
This is just refactoring code from DiagnoseUnreachable into a centralized
location.

rdar://29791263
2017-02-09 11:29:41 -08:00
Michael Gottesman
805786a913 [sil] Define SILFunctionType::isNoReturnFunction().
This just moves a bunch of queries that used information on SILFunction to
determine this property to just call a helper on SILFunctionType itself.

Centralized logic is good.

rdar://29791263
2017-02-09 11:29:40 -08:00
Joe Shajrawi
c478828de7 Support for Open Existentials that do no take an address 2017-02-09 11:25:34 -08:00
Jacob Bandes-Storch
e1fd8aa6c7 [Parse] Fix crash in conditional compilation parsing (#7331) 2017-02-08 23:10:26 -08:00
Slava Pestov
2eb25d413a Merge pull request #7356 from slavapestov/fix-nested-type-extension
Sema: Fix crash when defining an extension of a nested type with constrains
2017-02-08 22:18:04 -08:00
Rintaro Ishizaki
ff826e3491 [Parse] Limit max nesting level of StructureMarkerRAII (#7330)
The threshold is 256, for now.
2017-02-09 15:04:09 +09:00
Slava Pestov
707083d22f Sema: Fix crash when defining an extension of a nested type with constraints
If the nested type itself has generic constraints, we would
hit an assertion in requirement inference. Refactor some code
so that we can make the assertion more accurate.

Fixes <rdar://problem/30353095>.
2017-02-08 21:51:19 -08:00
Jacob Bandes-Storch
f2d426f285 [AST] CaptureListExpr's body is always a ClosureExpr (#7326) 2017-02-08 20:25:39 -08:00
Roman Levenstein
163f58e293 Merge pull request #7277 from swiftix/wip-partial-pre-specializations-wip-specialize-attribute-2
Teach EagerSpecializer how to use the new form of the @_specialize attribute
2017-02-08 20:07:54 -08:00
Slava Pestov
3652190866 Merge pull request #7346 from slavapestov/misc-gardening
Add a couple of regression tests and make a small cleanup
2017-02-08 20:00:23 -08:00
Michael Gottesman
ebf5cc607e [sil] Move PostOrderFunctionInfo from SILOptimizer/Analysis/PostOrderAnalysis => SIL/PostOrder.h.
There is already precedence for doing this via DominanceInfo. The reason I am
doing this is that I need the ownership verifier to be able to be run in Raw SIL
before no return folding has run. This means I need to be able to ignore
unreachable code resulting from SILGen not inserting unreachables after no
return functions.

The reason why SILGen does this is to preserve the source information of the
unreachable code so that we can emit nice errors about unreachable code.

rdar://29791263
2017-02-08 19:15:05 -08:00
swift-ci
d539b672d8 Merge pull request #7348 from gottesmm/fix_small_crasher 2017-02-08 17:33:05 -08:00
Hugh Bellamy
9ea5934618 Merge pull request #7335 from hughbe/clang-warnings
Fix unknown command tag name warnings
2017-02-09 08:06:56 +07:00
Michael Gottesman
49506557e3 [sil] Change SILResultInfo::getOwnershipKind to always take a CanGenericSignature.
This caused a crasher when running the ownership verifier. I don't have a test
case right now, since it happened several weeks ago.

The bug can not happen again since I eliminated the nullptr default argument.

rdar://29791263
2017-02-08 16:43:38 -08:00
Huon Wilson
ad5e17945f [AST] Diagnose recursive requirements whenever they appear.
Previously, these were only diagnosed in some situations, but the
compiler is becoming more flexible about when things get fed into
different places, and so can crop up elsewhere.
2017-02-08 16:26:31 -08:00
Slava Pestov
a16faae73b AST: Move ProtocolConformance::getTypeWitnessByName() to ProtocolConformanceRef
I need to move some #includes around ("include what you use") to
break circularities for an upcoming refactoring.
2017-02-08 15:33:46 -08:00
Huon Wilson
51da51dfc0 [AST] Use the requirement signature in the ArchetypeBuilder.
The requirement signature is far more compact than looking at all the members.
2017-02-08 13:09:36 -08:00
Huon Wilson
74091fbcef [AST] Store and serialize a protocol's requirement signature.
This is the "canonical" representation of the type-level requirements of
a protocol, and we intend to use it pervasively in the compiler.
2017-02-08 13:08:31 -08:00
Huon Wilson
a834780b0b [AST] PotentialArchetype's ConcreteTypeSource is in the Representative.
The correct/canonical ConcreteType and ConcreteTypeSource are both
stored in the Representative, but previously only the getter for the
former was tranversing the chain.
2017-02-08 13:08:31 -08:00
Erik Eckstein
254f36aba5 Revert "Use the new mangling for reflection."
This needs some changes in lldb.
Disabled for now until lldb supports the new mangling.

This reverts commit 21ba292943.
2017-02-08 09:01:51 -08:00
Hugh Bellamy
c65b49f52e Fix unknown command tag name warnings 2017-02-08 21:37:48 +07:00
Hugh Bellamy
a737a763e3 Fix MSVC "multiple copy constructors specified" warning 2017-02-08 21:25:50 +07:00
Roman Levenstein
2b9444e03a Add mangling support for partial specializations. 2017-02-07 23:16:00 -08:00
Roman Levenstein
26c963f27b Generic specializer API changes to prepare for the new @_specialize attribute and partial specializations. 2017-02-07 23:16:00 -08:00
Slava Pestov
bd4f31025f AST: GenericEnvironment::mapTypeIntoContext() no longer needs to take a ModuleDecl
Now, use LookUpConformanceInSignature instead.
2017-02-07 19:25:34 -08:00
Slava Pestov
2aea662cb7 AST: Introduce a new LookUpConformanceInSignature functor
For now, it "cheats" and performs the lookup in the module
declaring the protocol. This will change shortly.
2017-02-07 19:25:34 -08:00
Roman Levenstein
1e46f13184 Merge pull request #7321 from swiftix/layout-constraint-fixes
Layout constraint fixes
2017-02-07 18:37:35 -08:00
Jacob Bandes-Storch
c98e515734 [QoI] Improvements to function call & closure diagnostics (#7224) 2017-02-07 17:36:11 -08:00
Roman Levenstein
e5d5d7d5fd Some LayoutConstraint improvements.
This biggest change is:
- LayoutConstraintInfo is now a FoldingSetNode, which allows for proper canonicalization of LayoutConstraints. This is important for the correctness of type comparisons if types contain layout constraints.

No functionality changes from the client's point of view.
2017-02-07 17:03:11 -08:00
Doug Gregor
d34062455c Eliminate GenericEnvironment::clearGenericEnvironment(). NFC
Archetype builders used to create generic environments never go away,
so clearing them doesn't make sense anymore.
2017-02-07 15:50:29 -08:00
Slava Pestov
b8fd9e7259 AST: Move the well-formedness check from mangling to GenericSignature constructor 2017-02-07 15:30:39 -08:00
Doug Gregor
06f4c2fe4e Remove ArchetypeBuilder::getGenericEnvironment(). It's unused now 2017-02-07 15:22:50 -08:00
Doug Gregor
efe6175358 [Type Checker] Use GenericSignature::createGenericEnvironment().
New generic environments should be created directly from the generic
signature, without having to explicitly create an archetype
builder. Now, only the canonical archetype builders are ever used to
create a generic environment.
2017-02-07 15:22:50 -08:00
Jordan Rose
e4c3ae5794 Merge pull request #7312 from jrose-apple/print-stats-requires-assertions
[test] Disable -print-stats Serialization tests for no-asserts builds
2017-02-07 15:03:00 -08:00
Jordan Rose
f061ea435c Warn when using -print-stats on a release build.
This should make it easier to catch issues like the previous commit
in the future.
2017-02-07 13:31:01 -08:00
swift-ci
9cfa949891 Merge pull request #7307 from DougGregor/cleanup-potential-archetype 2017-02-07 11:40:37 -08:00
Doug Gregor
0c76a9d828 [Archetype builder] Clean up PotentialArchetype a bit.
Clean up the representation of PotentialArchetype in a few small ways:

* Eliminate the GenericTypeParamType* at the root, and instead just
  store a GenericParamKey. That makes the potential archetypes
  independent of a particular set of generic parameters.

* Give potential archetypes a link back to their owning
  ArchetypeBuilder, so we can get contextual information (etc.) when
  needed. We can remove the "builder" arguments as a separate step.

Also, collapse getName()/getDebugName()/getFullName() into
getNestedName() and getDebugName(). Generic parameters don't have
"names" per se, so they should only show up in debug dumps.

In support of the former, clean up some of the diagnostics emitted by
the archetype builder that were using 'Identifier' or 'StringRef'
where they should have been using a 'Type' (i.e., the type behind the
dependent archetype).
2017-02-07 11:15:11 -08:00
Jacob Bandes-Storch
d2831da80b [QoI] typo correction for anonymous closure params (#7255) 2017-02-07 11:12:34 -08:00
Erik Eckstein
21ba292943 Use the new mangling for reflection.
For this we are linking the new re-mangler instead of the old one into the swift runtime library.
Also we are linking the new de-mangling into the swift runtime library.

It also switches to the new mangling for class names of generic swift classes in the metadata.
Note that for non-generic class we still have to use the old mangling, because the ObjC runtime in the OS depends on it (it de-mangles the class names).
But names of generic classes are not handled by the ObjC runtime anyway, so there should be no problem to change the mangling for those.
The reason for this change is that it avoids linking the old re-mangler into the runtime library.
2017-02-07 08:36:21 -08:00
Erik Eckstein
e6f2e7bc88 Mangling: add a few utility functions in the new mangler and demangler which will be used by reflection mangling 2017-02-07 08:36:21 -08:00
swift-ci
ec274a1bbd Merge pull request #7298 from DougGregor/early-recursive-constraints 2017-02-06 23:28:51 -08:00