Commit Graph

30 Commits

Author SHA1 Message Date
Xi Ge
0191db3ede intermedia change. 2018-08-17 16:58:46 -07:00
Karoy Lorentey
b1c81e5ffe [test] Update api-digester source compatibility tests
DictionaryIterator & SetIterator have been renamed Dictionary.Iterator and Set.Iterator, with compatibility typealiases.
2018-08-16 20:05:32 +01:00
Xi Ge
3121af26e1 swift-api-digester: keep track of all decl attribute kinds in module dump. (#18473)
The tool should use decl attribute kinds from AST rather than defining
its own list of attributes. Thus we can keep track of all attributes kinds
rather than the selected ones.
2018-08-02 13:39:32 -07:00
Christian Bieniak
ec0d53f96f [stdlib] [SR-4005] Allow heterogenous comparisons in elementsEqual (#8045)
* [SR-4005] Allow heterogenous comparisons in elementsEqual

When a user is supplying a predicate to compare the type equivalence
isn’t required

* elementsEqualWithPredicate tests

Compares a string of a number with an integer value by using the
elementsEqualPredicate closure

* Update test expectations to use new sequence element types

* Update hardcoded test to reference sequence
2017-11-29 17:06:38 -08:00
Nate Cook
2e2e4d9bda Revert "Revert "[stdlib] Dictionary/Set enhancements""
This reverts commit 328ebe8567.
2017-05-01 16:06:14 -05:00
Arnold Schwaighofer
328ebe8567 Revert "[stdlib] Dictionary/Set enhancements" 2017-04-29 07:02:57 -07:00
Nate Cook
e2328885c1 [stdlib] Dictionary/Set enhancements
A variety of enhancements from SE-154 and SE-165:

- Custom Keys and Values collections for Dictionary
- Two sequence-based Dictionary initializers
- Merging methods for Dictionary
- Capacity checking and reserving for Dictionary and Set
- Type-specific filter(_:) methods for Dictionary and Set
- A mapValues(_:) method for Dictionary
- A grouping Dictionary initializer
2017-04-26 11:21:16 -05:00
Doug Gregor
29a15ce402 [Stdlib] Apply SE-0142 to fix ABI FIXME #92, part of ABI FIXME #99. 2017-04-19 23:15:33 -07:00
Max Moiseev
40184728e5 Listing expected source stability exceptions 2017-04-14 17:40:14 -07:00
Xi Ge
7ccef06aa8 Swift-api-digester: check self-parameter explicitly instead of using its context. NFC (#8660) 2017-04-10 13:53:48 -07:00
Roman Levenstein
2c811b82a1 Adjust some tests to pass in non-resilient and resilient modes. 2017-03-16 19:46:11 -07:00
Xi Ge
f4e478e93f swift-api-digester: use 0-based parameter index. rdar://30763215 2017-03-02 16:48:19 -08:00
Slava Pestov
66bcf5b756 stdlib: Address a couple of ABI FIXMEs by deleting code
We have an implicit conversion to AnyHashable, so there's no
need to have the special subscript on Dictionary at all.
2017-02-21 20:28:49 -08:00
Doug Gregor
fbb7dcf971 Replace concrete init(stringInterpolationSegment:)'s with generic ones
Remove 16 concrete init(stringInterpolationSegment:) overloads and
replace them with 3 generic overloads, significantly reducing the
exponential blow-up from larger string interpolations.

Fixes rdar://problem/29389887.
2017-02-08 21:01:09 -08:00
Doug Gregor
e387361194 Revert "Replace concrete init(stringInterpolationSegment:)'s with generic ones"
This reverts commit f6cac54606.
2017-02-08 13:38:11 -08:00
Doug Gregor
f6cac54606 Replace concrete init(stringInterpolationSegment:)'s with generic ones
Remove 16 concrete init(stringInterpolationSegment:) overloads and
replace them with 3 generic overloads, significantly reducing the
exponential blow-up from larger string interpolations.

Fixes rdar://problem/29389887.
2017-01-27 21:54:59 -08:00
Slava Pestov
6c75bf8dc5 Update source-stability test
It looks like we print generic parameters differently from
typealiases created to point to them.
2017-01-08 21:41:37 -08:00
Ben Cohen
8ade724c24 Tweak expected source stability results to handle specified rather than inferred iterator types 2017-01-05 11:59:49 -08:00
Ben Cohen
fefc2e40df Migrate _copyContents to be called from UnsafeMutableBufferPointer with checks for overrun. 2017-01-05 11:59:49 -08:00
Slava Pestov
a598ed68e6 Sema: Fixes for generic typealiases and nested type lookup
This patch contains several intertwined changes:

- Remove some unnecessary complexity and duplication.

- Adds a new TypeChecker::lookupUnqualifiedType() which bypasses most of
  the logic in TypeChecker::lookupUnqualified(), such as the
  LookupResultBuilder. Use this when resolving unqualified references
  to types.

- Fixes for generic typealiases to better preserve the type parameters of
  the parent type, and clean up the logic for applying the inner generic
  arguments. Some uses of generic typealiases that used to crash now work,
  and those tests have been uncommented.

- Avoid an unnecessary desugaring of TypeAliasDecls which map directly
  to GenericTypeParamTypes. Once again this perturbs the source-stability
  test.

- When looking up a nested type of a base class with a derived class base,
  always use the base class as the parent of the nested type. This fixes
  a recent regression where in some cases we were using the wrong parent.

Fixes <rdar://problem/29782186>.
2017-01-03 16:57:42 -08:00
Slava Pestov
2c6b9f71b6 AST: Change TypeAliasDecls to store an interface type as their underlying type
- TypeAliasDecl::getAliasType() is gone. Now, getDeclaredInterfaceType()
  always returns the NameAliasType.

- NameAliasTypes now always desugar to the underlying type as an
  interface type.

- The NameAliasType of a generic type alias no longer desugars to an
  UnboundGenericType; call TypeAliasDecl::getUnboundGenericType() if you
  want that.

- The "lazy mapTypeOutOfContext()" hack for deserialized TypeAliasDecls
  is gone.

- The process of constructing a synthesized TypeAliasDecl is much simpler
  now; instead of calling computeType(), setInterfaceType() and then
  setting the recursive properties in the right order, just call
  setUnderlyingType(), passing it either an interface type or a
  contextual type.

  In particular, many places weren't setting the recursive properties,
  such as the ClangImporter and deserialization. This meant that queries
  such as hasArchetype() or hasTypeParameter() would return incorrect
  results on NameAliasTypes, which caused various subtle problems.

- Finally, add some more tests for generic typealiases, most of which
  fail because they're still pretty broken.
2016-12-15 22:46:15 -08:00
Slava Pestov
1a991da16d AST: Assign interface types to ParamDecls
First, ensure all ParamDecls that are synthesized from scratch are given
both a contextual type and an interface type.

For ParamDecls written in source, add a new recordParamType() method to
GenericTypeResolver. This calls setType() or setInterfaceType() as
appropriate.

Interestingly enough a handful of diagnostics in the test suite have
improved. I'm not sure why, but I'll take it.

The ParamDecl::createUnboundSelf() method is now only used in the parser,
and no longer sets the type of the self parameter to the unbound generic
type. This was wrong anyway, since the type was always being overwritten.
This allows us to remove DeclContext::getSelfTypeOfContext().

Also, ensure that FuncDecl::getBodyResultTypeLoc() always has an interface
type for synthesized declarations, eliminating a mapTypeOutOfContext()
call when computing the function interface type in configureInterfaceType().

Finally, clean up the logic for resolving the DynamicSelfType. We now
get the interface or contextual type of 'Self' via the resolver, instead
of always getting the contextual type and patching it up inside
configureInterfaceType().
2016-12-04 00:02:21 -08:00
Slava Pestov
f6e692198c AST: Remove FuncDecl::getResultType() 2016-11-29 03:05:23 -07:00
Graydon Hoare
7c1dc18b64 Revert "Give all declarations an explicit interface type" 2016-11-24 09:55:27 -08:00
Slava Pestov
5b8524a9d1 AST: Remove FuncDecl::getResultType() 2016-11-24 02:35:35 -05:00
Slava Pestov
7ba5617a9d Update api-digester/source-stability.swift test
The swift-api-digester doesn't know about generic typealiases (yet?).
So it picks up some changes that are not actually source-breaking from
the previous patch.
2016-11-18 00:39:16 -08:00
Maxim Moiseev
32feae52b6 Marking .abs() method for floating point types as obsolete in Swift 4 (#5810)
* Marking .abs() method for floating point types as obsolete in Swift 4

...and deprecated in Swift 3.1
2016-11-16 14:00:10 -08:00
Xi Ge
327759c148 swift-sdk-digester: simplify change descriptions to allow empty expected output. 2016-11-01 13:54:35 -07:00
Xi Ge
edea59722e api-digester: teach the tool to detect new mutating/throwing functions (#5284) 2016-10-13 21:04:39 -07:00
Xi Ge
452ebbc6eb [Tools] Add a tool to detect source-breaking API changes introduced from libraries. (#5236)
[Tools] Add a tool to detect source-breaking API changes introduced from libraries.

swift-api-digester is a test utility to detect source-breaking API changes
during the evolution of a swift library. The tool works on two phases:
(1) dumping library contents as a json file, and (2) comparing two json
files textually to report interesting changes.

During phase (1), the api-digester looks up every declarations inside
a module and outputs a singly-rooted tree that encloses interesting
details of the API level.

During phase (2), api-digester applies structure-information comparision
algorithms on two given singly root trees, trying to figure out, as
precise as possible, the branches/leaves in the trees that differ from
each other. Further analysis decides whether the changed leaves/branches
can be reflected as source-breaking changes for API users. If they are,
the output of api-digester will include such changes.

Also, this commit includes a regression test that make sure API changes
from the Swift stdlib are expected.
2016-10-11 19:43:01 -07:00