Commit Graph

9699 Commits

Author SHA1 Message Date
Marc Rasi
44d7cdd4e6 constant interpreter: basic integer operations
Implements a constant interpreter that can deal with basic integer operations.

Summary of the features that it includes:
* builtin integer values, and builtin integer insts
* struct and tuple values, and insts that construct and extract them (necessary to use stdlib integers)
* function referencing and application (necessary to call stdlib integer functions)
* error handling data structures and logic, for telling you why your value is not evaluatable
* metatype values (not necessary for integers, but it's only a few extra lines, so I thought it would be more trouble than it's worth to put them in a separate PR)
* conditional branches (ditto)
2018-11-26 14:27:10 -08:00
Suyash Srijan
430d8a59b6 [ast] [diag] fix indentation 2018-11-26 21:52:25 +00:00
Suyash Srijan
3b8128ccf9 [silgen] Move diagnostic note creation to SILGenStmt 2018-11-26 21:50:31 +00:00
Suyash Srijan
174092aa8c Merge branch 'master' into fix/SR-8435 2018-11-26 19:36:51 +00:00
Suyash Srijan
4f39e3b588 [silgen] [ast] adds param name to diagnostics 2018-11-26 18:32:06 +00:00
Pavel Yaskevich
07e5d54855 [CSDiagnostics] Add custom diagnostic for invalid @autoclosure forwarding
Suggest to add `()` (form a call) to correctly forward argument function
originated from `@autoclosure` parameter to function parameter itself
marked as `@autoclosure`.
2018-11-21 12:17:25 -08:00
Suyash Srijan
4e3278e854 [ast] [diag] [sil] update diagnostic note 2018-11-19 22:57:25 +00:00
David Zarzycki
fef48a52e7 Merge pull request #20649 from davezarzycki/fix_Wdefaulted-function-deleted-warnings
[Misc] NFC: Fix -Wdefaulted-function-deleted warnings
2018-11-18 11:40:00 -05:00
Pavel Yaskevich
e18d390d18 Merge pull request #20663 from hamishknight/packing-up-the-flags
[AST] NFC: Pack @autoclosure parameter decl flag with the default value
2018-11-17 12:27:16 -08:00
Slava Pestov
e8e1f4f80d Merge pull request #20593 from slavapestov/keypath-resilience-fixes
Fix key paths for resilience and @inlinable
2018-11-17 13:13:53 -05:00
Hamish Knight
bec9a8c9cb [AST] NFC: Pack @autoclosure parameter decl flag with the default value 2018-11-17 13:31:40 +00:00
David Zarzycki
bf7f91b834 [Misc] NFC: Fix -Wdefaulted-function-deleted warnings 2018-11-17 08:30:59 -05:00
John McCall
49ba9c59d1 Allow Error to conform to itself.
Most of the foundation for this was laid in earlier patches.
2018-11-17 02:51:45 -05:00
Slava Pestov
0e1b62dcad SILGen: Don't emit or reference property descriptors for overrides
We want removing a property override to be a resilient change, so
keypaths should not reference them, preferring to reference the
base declaration instead.
2018-11-16 23:18:30 -05:00
Slava Pestov
0a8ee10621 AST: Refactor AbstractStorageDecl::getAccessStrategy() for keypath resilience
Instead of passing in a DeclContext, which we don't have when emitting a keypath
accessor, pass in a ModuleDecl and ResilienceExpansion.

Keypaths now work well enough in inlinable contexts that we can check in an
end-to-end resilience test.
2018-11-16 23:18:30 -05:00
Slava Pestov
bc119d0d6d SILGen: Emit inlinable keypath thunks from inlinable contexts
It's still not resilient because we emit direct references to stored
properties, but its progress.
2018-11-16 23:18:30 -05:00
John McCall
cd2b558280 Fix a bug with inlining self-conformances. 2018-11-16 22:59:12 -05:00
Suyash Srijan
15d2b4c2d4 [ast] [diag] [sil] add note for unreachable function body 2018-11-17 01:35:16 +00:00
Slava Pestov
7ffe361709 Sema: Clean up generic signature checking 2018-11-16 01:18:18 -05:00
John McCall
add6f126ad Merge pull request #20619 from rjmccall/self-conformance-fixes
Assorted fixes for the self-conformance infrastructure
2018-11-15 23:18:53 -05:00
John McCall
1065f99c71 Assorted fixes for the self-conformance infrastructure 2018-11-15 22:41:58 -05:00
Suyash Srijan
0d9f63474a [Sema] Emit a diagnostic when extending a protocol with a redundant requirement (#20503)
* Emit a warning diagnostic if an extension contains a redundant requirement

* Updates diagnostic message and checks if the extension type is a protocol

* Updates indentation and extracts self type

* [ast] Updates diagnostic message

* [ast] fix indentation

* [ast] Change ':' to 'to' in 'protocol_extension_redundant_requirement'

* [sema] Adds protocol extension redundant requirement check

Moved from TypeCheckRequests to TypeCheckGeneric

* [ast] fix some crashes related to null ptrs, check self type before emitting a diagnostic, update tests

* [ast] renames 'owner' to 'ext'

* [sema] fix style

* [test] Add another test case for redundant requirement

Co-Authored-By: theblixguy <suyashsrijan@outlook.com>

* [test] fix failing test

The test was failing because A has already been declared as a typealias.
2018-11-15 19:18:51 -08:00
John McCall
dd1130501f Merge pull request #20609 from rjmccall/pretty-stack-trace-conformance
[NFC] Add PrettyStackTraceConformance and use it
2018-11-15 19:31:25 -05:00
Saleem Abdulrasool
da724b34ed Merge pull request #20574 from compnerd/lazy-metadata
IRGen: force lazy metadata initialization for PE/COFF
2018-11-15 16:22:18 -08:00
John McCall
6ffeb4d839 [NFC] Add PrettyStackTraceConformance and use it
Also allow the printFooDescription functions to suppress
the trailing newline.
2018-11-15 18:39:35 -05:00
John McCall
5553224fd4 Support the explicit representation of self-conformances.
Big, but actually NFC because we're never actually creating them.
2018-11-15 16:42:03 -05:00
Saleem Abdulrasool
13d56a4f56 IRGen: force lazy metadata initialization for PE/COFF
The metadata reference to the pre-exsting VWT cannot be supported on PE/COFF
due to the direct reference to a value in an external module that is in
static data (the model requires indirecting through memory).  Always
force the lazy initialization for the metadata on such platforms.

This requires a secondary change - to initialize the VWT as well.  This
is ideally moved into the runtime where we can do this uniformly.
2018-11-15 11:05:47 -08:00
Arnold Schwaighofer
619673e1fa Merge pull request #20570 from aschwaighofer/synthesize_accessors_dynamic_globals
Synthesize accessors for dynamic global variables
2018-11-14 14:35:47 -08:00
Arnold Schwaighofer
40f0c43e31 Add isNativeDynamic() and use it 2018-11-14 12:04:41 -08:00
Arnold Schwaighofer
c3230dfc5c Add the implicit dynamic attribute in the IsDynamicRequest query 2018-11-14 12:04:17 -08:00
Graydon Hoare
f212d185c5 Merge pull request #20458 from graydon/text-interface-format-version
Text interface format version
2018-11-14 09:19:27 -08:00
Arnold Schwaighofer
9debb38204 Merge pull request #20525 from aschwaighofer/code_completion_private_imports
Make sure the code completion takes both private imports and testable
2018-11-14 07:51:19 -08:00
Arnold Schwaighofer
49cdab2c12 Fix typo 2018-11-14 06:29:22 -08:00
Slava Pestov
eb147d9ec6 Merge pull request #20531 from slavapestov/inline-always-is-not-inlinable
@inline(__always) should not imply @inlinable
2018-11-13 20:39:35 -05:00
Graydon Hoare
74dc5a1558 [ModuleInterface] Remove protected helper, redundant with visible dependencyTracker member. 2018-11-13 13:53:46 -08:00
Slava Pestov
6e4400567b AST: Allow @inline(__always)/@inline(never) to be applied to properties and subscripts
Previously we only permitted it on the accessor itself, but there is
no reason not to allow it on the storage declaration.

Fixes <https://bugs.swift.org/browse/SR-3624> / <rdar://problem/31865137>.
2018-11-13 16:40:31 -05:00
swift-ci
c6874bb403 Merge pull request #20512 from harlanhaskins/storage-wars 2018-11-13 13:30:46 -08:00
Graydon Hoare
657543119c [ModuleInterface] Version string (semi)finalization, format version checking. 2018-11-13 13:25:15 -08:00
Graydon Hoare
8959923ac8 [ModuleInterface] Propagate dependencies to outer DependencyTracker for use in .d files. 2018-11-13 13:25:15 -08:00
Graydon Hoare
d44943a482 [ModuleInterface] Include and dedupe (transitive) FILE_DEPENDENCY records from dependencies. 2018-11-13 13:25:15 -08:00
Graydon Hoare
be7fcfdc2d [ModuleInterface] Emit error when we fail to find a dependency. 2018-11-13 13:24:23 -08:00
Graydon Hoare
d4e6479f88 Add a new ForwardingDiagnosticConsumer type. 2018-11-13 13:24:22 -08:00
swift-ci
9334458c61 Merge pull request #20472 from DougGregor/abi-mangled-assoc-conformances-in-witness-tables 2018-11-12 21:09:34 -08:00
Slava Pestov
3e864b26aa AST: @inline(__always) no longer implies @inlinable
Fixes <rdar://problem/44657000>.
2018-11-12 21:00:15 -05:00
Arnold Schwaighofer
2ac6cda9a7 Make sure the code completion takes both private imports and testable
imports into account separately.
2018-11-12 14:53:56 -08:00
Harlan Haskins
66a61c5eca Rename @sil_stored to @_hasStorage 2018-11-12 11:32:32 -08:00
Joe Groff
adba1535e5 Merge pull request #20211 from Azoy/sr8811-warning
[Sema] Uninhabited stored property downgrade to warning
2018-11-12 11:18:33 -08:00
Arnold Schwaighofer
853388c930 Merge pull request #20478 from aschwaighofer/disable_dynamic_replacement_chaining
Add support to modify chaining behavior of dynamic replacements
2018-11-12 10:37:58 -08:00
Doug Gregor
6fd878c2b3 [Sema] Lazily fill in signature conformances as needed.
If the type checker doesn't prepopulate signature conformances, fill
them in when we first need them. This is a stopgap solution until we
can move these queries over to the request-evaluator.

Fixes rdar://problem/34584596, as well as a regression introduced by
the use of mangled names for associated conformances in witness tables.
2018-11-12 09:42:51 -08:00
Dan Zheng
2863b6cc64 Gardening for @dynamicMemberLookup. (#20498)
* Gardening for `@dynamicMemberLookup`.

- Unify code style of `@dynamicMemberLookup` and `@dynamicCallable` implementations.
  - Use consistent variable names, diagnostic messages, doc comments, etc.
- Move `@dynamicMemberLookup` test to `test/attr` directory.
2018-11-11 21:54:19 -05:00