Commit Graph

9699 Commits

Author SHA1 Message Date
John McCall
cf511445e2 Basic support for Builtin.IntegerLiteral. 2018-10-31 18:42:34 -04:00
John McCall
4ea01224fd [NFC] Improve the interfaces for integer widths and parsing integers 2018-10-31 15:49:40 -04:00
Slava Pestov
4063124c45 AST: Remove isSwiftVersion3() 2018-10-30 16:46:08 -04:00
Slava Pestov
026895673b Remove Swift 3 unavailable witness behavior 2018-10-30 16:46:08 -04:00
Slava Pestov
3265bffa8f Parse: Remove the fixit for curried parameter lists, its wrong anyway
Fixes <rdar://problem/45274153>.
2018-10-30 14:02:35 -04:00
swift-ci
c4a4b0d1b3 Merge pull request #20058 from nkcsgexi/type-witness-diag 2018-10-26 11:59:03 -07:00
Jordan Rose
4710c43b01 Merge pull request #19992 from Azoy/sr-8811
[Sema] Disallow stored properties to have uninhabited types
2018-10-26 10:31:02 -07:00
Doug Gregor
b5bc06e552 [ABI] Eliminate witness table accessors.
Witness table accessors return a witness table for a given type's
conformance to a protocol. They are called directly from IRGen
(when we need the witness table instance) and from runtime conformance
checking (swift_conformsToProtocol digs the access function out of the
protocol conformance record). They have two interesting functions:

1) For witness tables requiring instantiation, they call
swift_instantiateWitnessTable directly.
2) For synthesized witness tables that might not be unique, they call
swift_getForeignWitnessTable.

Extend swift_instantiateWitnessTable() to handle both runtime
uniquing (for #2) as well as handling witness tables that don't have
a "generic table", i.e., don't need any actual instantiation. Use it
as the universal entry point for "get a witness table given a specific
conformance descriptor and type", eliminating witness table accessors
entirely.

Make a few related simplifications:

* Drop the "pattern" from the generic witness table. Instead, store
  the pattern in the main part of the conformance descriptor, always.
* Drop the "conformance kind" from the protocol conformance
  descriptor, since it was only there to distinguish between witness
  table (pattern) vs. witness table accessor.
* Internalize swift_getForeignWitnessTable(); IRGen no longer needs to
  call it.

Reduces the code size of the standard library (+assertions build) by
~149k.

Addresses rdar://problem/45489388.
2018-10-25 20:35:27 -07:00
Xi Ge
49c16922dd swift-module-digester: diagnose type witness type changes when checking ABI stability. 2018-10-25 16:40:23 -07:00
Jordan Rose
7cad780701 [AST] Sink ModuleDecl's flags down into the shared Decl bitfields (#20051)
Saves 4 bytes per ModuleDecl. No functionality change.
2018-10-25 15:53:51 -07:00
Robert Widmann
3082bbfc36 Merge pull request #20002 from adamshin/enum-raw-type-message
[sema] Fix error message for enums with an invalid raw type
2018-10-25 16:23:57 -04:00
Pavel Yaskevich
401c5e868d Merge pull request #20016 from xedin/rdar-45489901
[ABI/Metadata] Add `@autoclosure` to function parameter flags
2018-10-25 11:12:58 -07:00
Pavel Yaskevich
621b970b53 [ABI/Metadata] Add @autoclosure to function parameter flags
Add `@autoclosure` to parameter flags associated with
function type metadata, which makes it possible to correctly
round-trip mangled name <-> metadata of function types which
have parameters marked as `@autoclosure`.

Resolves: rdar://problem/45489901
2018-10-24 15:29:30 -07:00
Jordan Rose
dc3ff6c22b Merge pull request #19985 from vinivendra/ast-dump-cleanup
Cleans up calls to print/dump for the AST Dumper
2018-10-24 15:22:41 -07:00
Azoy
f085c28865 Not just instance members & better diagnostic
fix some tests
2018-10-23 18:08:00 -05:00
Doug Gregor
5b41ac16db [ABI] Introduce indirect symbolic references to context descriptors.
Extending the mangling of symbolic references to also include indirect
symbolic references. This allows mangled names to refer to context
descriptors (both type and protocol) not in the current source file.

For now, only permit indirect symbolic references within the current module,
because remote mirrors (among other things) is unable to handle relocations.

Co-authored-by: Joe Groff <jgroff@apple.com>
2018-10-23 16:06:42 -07:00
Adam Shin
1e5b464bc3 [sema] Give a more accurate error message for enums with an invalid raw type 2018-10-23 16:24:03 -06:00
Azoy
7991aecfce Disallow stored properties to have uninhabited types
Reword comment

Add tuple test case
2018-10-22 19:13:19 -05:00
Greg Titus
d20fdf5f82 Merge pull request #19920 from gregomni/8757
[Sema][QoI] Call out missing conformances in protocol witness candidates.
2018-10-22 16:39:51 -07:00
Vinicius Vendramini
b61df445ae Cleans up calls to print/dump for the AST Dumper
The `Stmt` and `Expr` classes had both `dump` and `print` methods that behaved similarly, making it unclear what each method was for. Following a conversation in https://forums.swift.org/t/unifying-printing-logic-in-astdumper/15995/6 the `dump` methods will be used to print the S-Expression-like ASTs, and the `print` methods will be used to print the more textual ASTPrinter-based representations. The `Stmt` and `Expr` classes seem to be where this distinction was more ambiguous. These changes should fix that ambiguity.

A few other classes also have `print` methods used to print straightforward representations that are neither the S-Expressions nor ASTPrinters. These were left as they are, as they don't cause the same ambiguity.

It should be noted that the ASTPrinter implementations themselves haven't yet been finished and aren't a part of these changes.
2018-10-22 16:04:02 -03:00
swift-ci
7a7657b0f3 Merge pull request #19935 from graydon/text-interface-to-module 2018-10-20 22:22:47 -07:00
John McCall
d60af18ba3 Merge pull request #19964 from rjmccall/builtin-ownership
Emit certain builtin arguments as owned values
2018-10-20 02:34:55 -04:00
John McCall
5248a9f637 Add convenience functions for mapping ownership <-> specifiers. 2018-10-20 00:24:38 -04:00
John McCall
1784875819 Store value ownership generically in ParameterTypeFlags; NFC. 2018-10-20 00:24:38 -04:00
gregomni
939de4fb4a Extend candidate missing conformance checking to other types of requirements so that we check superclass and same type requirements in the same way. 2018-10-19 10:02:30 -07:00
Pavel Yaskevich
e20723f6c8 [ConstraintSystem] Replace curry level with a boolean flag
Arbitrary currying is no longer allowed so level could be switched
to a boolean flag for methods like `computeDefaultMap` to identify
if they need to look through curried self type or not.
2018-10-18 17:50:05 -07:00
Graydon Hoare
fa95f7aebd [ModuleInterface] Factor out common AST-layer withOutputFile helper. 2018-10-18 00:31:24 -07:00
gregomni
002c04ef96 Modified diagnostics a bit given feedback 2018-10-17 07:35:44 -07:00
gregomni
f2a80c4a9d Let CS::solveSingle() optionally allow fixes in the solution. Use this in protocol inference to give better candidate failure notes. 2018-10-16 15:27:09 -07:00
Slava Pestov
8a93766633 Merge pull request #19869 from slavapestov/unqualified-lookup-fixes
Unqualified lookup fixes
2018-10-15 13:09:21 -07:00
Andrew Trick
e3a75de818 Merge pull request #19849 from atrick/remove-swift3-exclusivity
Remove exclusivity support for Swift 3 mode.
2018-10-15 11:03:06 -07:00
Slava Pestov
8acc11f80c Sema: Fix ambiguity resolution when doing unqualified lookup of associated types and type aliases
In structural lookup mode, let's resolve protocol typealiases to
dependent member types also. This is because areSameType() has
no way to see if a type alias is going to be equal to another
associated type with the same name, and so it would return false,
which produced ambiguity errors when there should not be any.

This exposes a deficiency in how we diagnose same-type constraints
where both sides are concrete. Instead of performing the check on
the requirement types, which might be dependent member types that
later on resolve to concrete types, do the check on the actual
equivalence classes further down in the GSB instead.

However, this in turn produces bogus diagnostics in some recursive
cases where we add same-type constraints twice for some reason,
resulting in a warning the second time around. Refine the check by
adding a new predicate to FloatingRequirementSource for requirements
that are explicitly written in source... which is not what
isExplicit() currently means.
2018-10-15 01:52:11 -07:00
Greg Titus
5f2400580e Merge pull request #19830 from gregomni/8813
[Sema] When resolving type declarations, if there is an error with a typealias,...
2018-10-13 21:39:10 -07:00
Slava Pestov
9d131fd5f1 Merge pull request #18999 from hamishknight/location-by-association
[GSB] Avoid emitting associated type diagnostics on the protocol decl
2018-10-13 15:16:40 -07:00
Robert Widmann
13cfe6e65d Merge pull request #19854 from gregomni/dead-repr-visit
[NFC] Remove dead code in TypeRepr
2018-10-13 09:39:30 -04:00
Mark Lacey
ab0ae73f94 Merge pull request #19816 from rudkx/extend-operator-designated-type
Add support for multiple designated types for an operator declaration.
2018-10-12 15:47:17 -07:00
Andrew Trick
2ecb48a89d Remove exclusivity support for Swift 3 mode.
Remove the compiler support for exclusivity warnings.

Leave runtime support for exclusivity warnings in non-release builds
only for unit testing convenience.

Remove a test case that checked the warning log output.

Modify test cases that relied on successful compilation in the
presence of exclusivity violations.

Fixes: <rdar://problem/45146046> Remaining -swift-version 3 tests for exclusivity
2018-10-12 09:08:42 -07:00
gregomni
6ec94c0279 Remove dead code. 2018-10-12 08:34:37 -07:00
gregomni
bb98a0f95f Simplify checking code as much as possible, since this is a hacky diagnosis anyway. 2018-10-12 07:23:56 -07:00
Slava Pestov
36c8d94238 AST: Refactor SelfBoundsFromWhereClause to support ProtocolDecls 2018-10-12 03:06:52 -07:00
Slava Pestov
673e167fac AST: Refactor lookupQualified() to take a vector of NominalTypeDecls
Previously you could pass in a vector of TypeDecls and it handled
module and AnyObject lookup for you. The AnyObject case was never
used and the module was was only needed in one place, so clean
things up to make them more direct here.
2018-10-12 03:06:52 -07:00
Graydon Hoare
5e202697a3 [ModuleInterface] Mop up remaining "textual interface" terminology. 2018-10-11 23:56:19 -07:00
Graydon Hoare
f942ae5fcc [ModuleInterface] Add errors for failures-to-extract from .swiftinterface. 2018-10-11 16:43:50 -07:00
Mark Lacey
cb5fd7f8d7 Merge branch 'master' into extend-operator-designated-type 2018-10-11 07:51:23 -07:00
Rintaro Ishizaki
8d37c79ed6 Merge pull request #17649 from AnthonyLatsis/code-compl-precedencegroups
[Parse][CodeCompletion] Completions for precedencegroup decls
2018-10-11 15:45:17 +09:00
Doug Gregor
264b680e96 Merge branch 'master' into immortal-type-checker 2018-10-10 20:36:23 -07:00
Doug Gregor
599e07e5d9 [Type checker] Keep the type checker alive as long as the ASTContext is.
It is possible for the SIL optimizers, IRGen, etc. to request information
from the AST that only the type checker can provide, but the type checker
is typically torn down after the “type checking” phase. This can lead to
various crashes late in the compilation cycle.

Keep the type checker instance around as long as the ASTContext is alive
or until someone asks for it to be destroyed.

Fixes SR-285 / rdar://problem/23677338.
2018-10-10 16:44:42 -07:00
Raj Barik
bb34051850 Enable ExistentialSpecializer by default 2018-10-10 10:15:35 -07:00
Arnold Schwaighofer
6c571305bc Merge pull request #19716 from aschwaighofer/assume
Add the Swift equivalent of the llvm.assume intrinsic
2018-10-10 06:12:33 -07:00
Mark Lacey
d8c826da15 Fix up AST printing for multiple types specified in operator decl. 2018-10-10 05:03:17 -07:00