Commit Graph

66 Commits

Author SHA1 Message Date
Hamish Knight
1cb0f8fdd5 [AST] Rename isPrivateStdlibDecl -> isPrivateSystemDecl
This better reflects what we're actually checking
here.
2024-08-28 18:31:51 +01:00
Ben Barham
0020766a95 [Tests] Updates for LLVM StringMap iteration order change 2023-08-11 12:45:44 -07:00
Alexis Laferrière
7f32a9e8c4 [IDE] Inject Sendable conformance on public types only
When getTopLevelDeclsForDisplay is called on an imported module, it may
lists non-public decls. If we they try to inject the conformance on
Sendable on internal types, the compiler may crash on failing to
deserialize internal details. As a fix, let's only inject the
conformance on public or package types.

rdar://95430471
2023-04-14 13:40:02 -07:00
Doug Gregor
68b367b266 Disable macros-related tests harder 2023-03-29 16:32:32 -07:00
Doug Gregor
30f17940f9 Require the Swift swift parser for a few tests affected by macros 2023-03-29 16:32:32 -07:00
Doug Gregor
7000969f14 Introduce and use #externalMacro for externally-defined macros.
Align the grammar of macro declarations with SE-0382, so that macro
definitions are parsed as an expression. External macro definitions
are referenced via a referenced to the macro `#externalMacro`. Define
that macro in the standard library, and recognize uses of it as the
definition of other macros to use externally-defined macros. For
example, this means that the "stringify" macro used in a lot of
examples is now defined as something like this:

    @expression macro stringify<T>(_ value: T) -> (T, String) =
        #externalMacro(module: "MyMacros", type: "StringifyMacro")

We still parse the old "A.B" syntax for two reasons. First, it's
helpful to anyone who has existing code using the prior syntax, so they
get a warning + Fix-It to rewrite to the new syntax. Second, we use it
to define builtin macros like `externalMacro` itself, which looks like this:

    @expression
    public macro externalMacro<T>(module: String, type: String) -> T =
        Builtin.ExternalMacro

This uses the same virtual `Builtin` module as other library builtins,
and we can expand it to handle other builtin macro implementations
(such as #line) over time.
2023-01-02 21:22:05 -08:00
Ben Cohen
df2307e035 [stdlib][DNM] Collapse sequence and collection wrappers (#20221)
* Concretize dropFirst/Last/sufix/prefix from Sequence

Remove split customization point

Eliminate SubSequence from Sequence protocol

Collapse LazyCollection

Collapse LazyMapCollection

Eliminate _SequenceWrapper

Collapse LazyFilterCollection

Collapse LazyDrop/PrefixWhileCollection

Fix tests, ABI stability update

Collapse FlattenSequence

* Add entries to source/ABI compatible expected results.

* Update tests to avoid pre-10.14 objc runtime bug

* Expunge _preprocessingPass
2018-11-14 10:05:58 -08:00
Ben Cohen
436b8610e7 [stdlib][WIP] Factor out common parts of pointer types and de-gyb (#17951)
* Add conformances to _Pointer and remove from pointer types

* De-gyb pointer files
2018-07-14 07:36:45 -07:00
Michael Ilseman
3be2faf5d3 [String] Initial implementation of 64-bit StringGuts.
Include the initial implementation of _StringGuts, a 2-word
replacement for _LegacyStringCore. 64-bit Darwin supported, 32-bit and
Linux support in subsequent commits.
2018-01-21 12:32:26 -08:00
Michael Ilseman
75463e30f3 [stdlib] Rename _StringCore to _LegacyStringCore. NFC.
In grand LLVM tradition, the first step to redesigning _StringCore is
to first rename it to _LegacyStringCore. Subsequent commits will
introduce the replacement, and eventually all uses of the old one will
be moved to the new one.

NFC.
2018-01-21 12:28:56 -08:00
Doug Gregor
2e2c7e8dd6 Update tests for removal of ImplicitlyUnwrappedOptional extensions. 2017-11-01 17:13:32 -07:00
Ben Cohen
31c1d8d52e Remove no-longer-used _Incrementable protocol (#12251) 2017-10-03 15:08:18 -07:00
Max Moiseev
a167238d1d Fixing more tests 2017-01-12 15:54:56 -08:00
David Farler
b7d17b25ba Rename -parse flag to -typecheck
A parse-only option is needed for parse performance tracking and the
current option also includes semantic analysis.
2016-11-28 10:50:55 -08:00
Slava Pestov
7eaff4a346 Update IDE/print_stdlib.swift test
I don't know what the 'CHECK-NOT: extension [' line means, but now
we have a nested type inside Dictionary.
2016-11-18 00:39:16 -08:00
Dmitri Gribenko
d175b3b66d Migrate FileCheck to %FileCheck in tests 2016-08-10 23:52:02 -07:00
Andrew Trick
a41484ea2b Add UnsafeRawPointer type and API. (#3677)
* Add UnsafeRawPointer type and API.

As proposed in SE-0107:   UnsafeRawPointer.
https://github.com/apple/swift-evolution/blob/master/proposals/0107-unsaferawpointer.md

The fundamental difference between Unsafe[Mutable]RawPointer and
Unsafe[Mutable]Pointer<Pointee> is simply that the former is used for "untyped"
memory access, and the later is used for "typed" memory access. Let's refer to
these as "raw pointers" and "typed pointers". Because operations on raw pointers
access untyped memory, the compiler cannot make assumptions about the underlying
type of memory and must be conservative. With operations on typed pointers, the
compiler may make strict assumptions about the type of the underlying memory,
which allows more aggressive optimization.

Memory can only be accessed by a typed pointer when it is currently
bound to the Pointee type. Memory can be bound to type `T` via:
- `UnsafePointer<T>.allocate(capacity: n)`
- `UnsafePointer<Pointee>.withMemoryRebound(to: T.self, capacity: n) {...}`
- `UnsafeMutableRawPointer.initializeMemory(as: T.self, at: i, count: n, to: x)`
- `UnsafeMutableRawPointer.initializeMemory(as: T.self, from: p, count: n)`
- `UnsafeMutableRawPointer.moveInitializeMemory(as: T.self, from: p, count: n)`
- `UnsafeMutableRawPointer.bindMemory(to: T.self, capacity: n)`

Mangle UnsafeRawPointer as predefined substitution 'Sv' for Swift void
pointer ([urp] are taken).

* UnsafeRawPointer minor improvements.

Incorporate Dmitri's feedback.

Properly use a _memmove helper.

Add load/storeBytes alignment precondition checks.

Reword comments.

Demangler tests.

* Fix name mangling test cases.

* Fix bind_memory specialization.
2016-07-22 13:32:08 -07:00
Robert Widmann
f97e5dcb0e [SE-0115][1/2] Rename *LiteralConvertible protocols to ExpressibleBy*Literal. This
change includes both the necessary protocol updates and the deprecation
warnings
suitable for migration.  A future patch will remove the renamings and
make this
a hard error.
2016-07-12 15:25:24 -07:00
swift-ci
fe13e6c0e3 Merge pull request #2905 from frootloops/int32 2016-07-01 19:10:12 -07:00
Ben Langmuir
bb9dc20a93 [ide] Add _builtin to things we shouldn't see in the stdlib interface
To make sure we're covering the init(_builtin*) initializers for the
compiler protocols.
2016-06-22 14:19:17 -07:00
Ben Langmuir
4711e3d529 [ide] Split print_stdlib into specialized and unspecialized tests
... so that we can keep the unspecialized print_stdlib test in the
regular test set, and only the specialized one needs to be a long_test.
Without the specialized interface cases, this test only takes ~1 second
for me, compared with the specialized test taking 30+ seconds.
2016-06-22 14:19:17 -07:00
Trent Nadeau
b9db36cda5 Removed last uses of @warn_unused_result 2016-06-06 19:12:51 -04:00
Dmitri Gribenko
a30f90c965 CMake: move tricky code from CMake to Python
Removing an abstraction boundary also allowed me to fix a bug where we
could not run long tests in optimized mode, which prevented us from
being able to mark executable tests as long.
2016-06-06 01:02:03 -07:00
Dmitri Gribenko
1ce495f5f1 Mark two expensive tests with long_test 2016-06-05 18:22:17 -07:00
Arsen Gasparyan
2c634e7fca Change all uses of 'CInt' to 'Int32' in the SDK overlay 2016-06-05 20:52:23 +03:00
Argyrios Kyrtzidis
b9d3d8909b Make sure to hide constructors with underscored API names as private stdlib symbols.
This completely removes 'Builtin.<type>' from the interface.
The changes in stdlib interface were reviewed by Dmitri.
2016-06-01 22:39:30 -07:00
Xi Ge
173e954cc2 test: update IDE and SourceKit tests due to stdlib changes. 2016-04-05 15:19:28 -07:00
Xi Ge
6665c4850b ModulePrinting: Synthesize extensions for protocols as well. 2016-03-17 21:59:25 -07:00
Xi Ge
ce9793fe15 [Test] Add module printing test for recently added module groups. 2016-03-16 17:29:37 -07:00
Xi Ge
907cd00afb [Test] Whitelist underscored Stdlib protocols that should show in the generated interface. 2016-03-11 14:08:39 -08:00
Xi Ge
13e7e1f7be ModulePrinting: Not showing @warn_unused_result in the printed module interface. 2016-03-10 17:56:35 -08:00
Max Moiseev
885b564bf5 Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-03-09 17:16:37 -08:00
Xi Ge
d81edcb6b6 ModulePrinting: Properly substitute via metatype to simplify complex bound generic types appearing in synthesized extensions. rdar://25063840 2016-03-09 17:09:34 -08:00
Max Moiseev
02006f20bc Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-03-09 16:05:03 -08:00
Argyrios Kyrtzidis
c939234d1f [test] Modify the test so that it can pass on linux as well. 2016-03-08 23:59:13 -08:00
Argyrios Kyrtzidis
345d05e2e9 Introduce an internal attribute '@_show_in_interface' to be used in stdlib for underscored protocols that
should be shown in the interface.

Also switch the option and hide all underscored protocols by default, unless they are marked with the new attribute.
2016-03-08 23:30:58 -08:00
Xi Ge
fbd74a317d [Test] Add a test to make sure every group has decls to print. 2016-02-29 12:03:50 -08:00
Xi Ge
5270e62bb4 [test] swift-ide-test: Add a test to ensure that future stdlib public source files are properly grouped. 2016-02-24 16:21:26 -08:00
Argyrios Kyrtzidis
04e3949985 [ASTPrint] Introduce a printing option to hide underscored protocols in the stdlib. 2015-12-02 22:38:34 -08:00
Argyrios Kyrtzidis
5ac9e39d61 [ASTPrint] Make sure we hide the new literals (color, image, etc.) from the stdlib interface.
rdar://22632345

Swift SVN r31846
2015-09-10 02:03:13 +00:00
Xi Ge
efb19787a1 [InterfaceGen] Not printing '@rethrows' since we print 'rethrows'. rdar://22449614
Swift SVN r31538
2015-08-27 18:47:41 +00:00
Dave Abrahams
ad43a596bd [stdlib] Retire the old lazy subsystem...
...replacing it with the new, after passing API review!

* The lazy free function has become a property.

* Before we could extend protocols, we lacked a means for value types to
  share implementations, and each new lazy algorithm had to be added to
  each of up to four types: LazySequence, LazyForwardCollection,
  LazyBidirectionalCollection, and LazyRandomAccessCollection. These
  generic adapters hid the usual algorithms by defining their own
  versions that returned new lazy generic adapters. Now users can extend
  just one of two protocols to do the same thing: LazySequenceType or
  LazyCollectionType.

* To avoid making the code duplication worse than it already was, the
  generic adapters mentioned above were used to add the lazy generic
  algorithms around simpler adapters such as MapSequence that just
  provided the basic requirements of SequenceType by applying a
  transformation to some base sequence, resulting in deeply nested
  generic types as shown here. Now, MapSequence is an instance of
  LazySequenceType (and is renamed LazyMapSequence), and thus transmits
  laziness to its algorithms automatically.

* Documentation comments have been rewritten.

* The .array property was retired

* various renamings

* A bunch of Gyb files were retired.

Swift SVN r30902
2015-08-01 03:52:13 +00:00
Dave Abrahams
88aaed0a0c [stdlib] Move most of the lazy prototype into the stdlib
Swift SVN r30144
2015-07-13 15:36:17 +00:00
Dave Abrahams
03c44ad654 [stdlib] Fix one more test
Being conscientious about underscore prefixing can be costly.

Swift SVN r29691
2015-06-25 21:59:37 +00:00
Argyrios Kyrtzidis
212989e3cd [stdlib] Underscore a parameter name to hide its initializer from the interface.
Verified by Dmitri.

Swift SVN r29196
2015-06-01 00:26:47 +00:00
Argyrios Kyrtzidis
658d852f68 [IDE] When printing stdlib interface, hide underscored members of protocols, and subscript
decls that have underscored parameters.

Dmitri verified that the removals after this change are ok.

Swift SVN r29177
2015-05-31 00:41:09 +00:00
John McCall
6287d913c3 By default, hide the actual implementing accessors of properties
and subscripts when printing them; just print them as get/set.

The important thing here is that we don't want to show the
names of addressors and mutable addressors when pretty-printing
the stdlib, but hiding observers is also general goodness.

Swift SVN r24875
2015-01-31 05:03:51 +00:00
Dmitri Hrybenko
3b04d1b013 tests: reorganize tests so that they actually use the target platform
Most tests were using %swift or similar substitutions, which did not
include the target triple and SDK.  The driver was defaulting to the
host OS.  Thus, we could not run the tests when the standard library was
not built for OS X.

Swift SVN r24504
2015-01-19 06:52:49 +00:00
Maxwell Swadling
963619cdc1 [stdlib] C_ARG{c,v} renamed to argc/unsafeArgv
Fixes rdar://problem/17229052
Make it clear C_ARGV var is unsafe.
Made it impossible to set the argc/unsafeArgv outside of the stdlib.
Refactored tests to not use C_ARG{C,V}.
Made C_ARG{C,V} unavailable.

Swift SVN r23249
2014-11-11 22:34:49 +00:00
Dmitri Hrybenko
1335a05e15 stdlib: remove FIXMEs from stdlib doc comments and add a test to catch these in
future

rdar://17906333


Swift SVN r21037
2014-08-05 09:31:10 +00:00