Commit Graph

11880 Commits

Author SHA1 Message Date
Robert Widmann
5a8d0744c3 [NFC] Adopt TypeBase-isms for GenericSignature
Structurally prevent a number of common anti-patterns involving generic
signatures by separating the interface into GenericSignature and the
implementation into GenericSignatureBase.  In particular, this allows
the comparison operators to be deleted which forces callers to
canonicalize the signature or ask to compare pointers explicitly.
2019-09-30 14:04:36 -07:00
swift-ci
26a8bf8e75 Merge remote-tracking branch 'origin/master' into master-rebranch 2019-09-30 08:43:50 -07:00
David Ungar
ea81fdc7d8 Merge pull request #27313 from davidungar/generic-request-or-extended-nominal-assertion
Fail early if getExtendedNominal is called before extension has been bound.
2019-09-30 08:37:33 -07:00
David Ungar
4bc4030338 Catch failures earlier caused by premature requests for extended nominal 2019-09-28 15:19:32 -07:00
swift-ci
17a81a400f Merge remote-tracking branch 'origin/master' into master-rebranch 2019-09-27 18:03:59 -07:00
Jordan Rose
b34d2c5eb9 [AST] Add Type::wrapInPointer(PointerTypeKind)
...replacing a similar utility in the type checker and one I just
added in ClangImporter earlier in this patch series. This is an
ever-so-slight regression in functionality because a missing pointer
declaration used to print a diagnostic and now it will just crash on
an invalid standard library, but I don't think we should be optimizing
for an invalid standard library anyway.
2019-09-27 14:27:33 -07:00
swift-ci
47c27e5880 Merge remote-tracking branch 'origin/master' into master-next 2019-09-27 12:42:27 -07:00
swift-ci
67e0f740c1 Merge remote-tracking branch 'origin/master' into master-rebranch 2019-09-27 11:23:52 -07:00
Xi Ge
aeed242428 Merge pull request #27398 from nkcsgexi/get-loc-refactor
AST: refactor getLoc() of decls to have a single entry point for all decl kinds, NFC
2019-09-26 20:45:35 -07:00
Harlan Haskins
d4247942c4 Merge remote-tracking branch 'upstream/master' into master-next 2019-09-26 20:19:25 -07:00
Harlan Haskins
e349b7b123 Merge branch 'master' into master-rebranch 2019-09-26 20:16:05 -07:00
Jordan Rose
a6dd630ca3 Eliminate Builtin.UnknownObject as an AST type (#27378)
This removes it from the AST and largely replaces it with AnyObject
at the SIL and IRGen layers. Some notes:

- Reflection still uses the notion of "unknown object" to mean an
  object with unknown refcounting. There's no real reason to make
  this different from AnyObject (an existential containing a
  single object with unknown refcounting), but this way nothing
  changes for clients of Reflection, and it's consistent with how
  native objects are represented.

- The value witness table and reflection descriptor for AnyObject
  use the mangling "BO" instead of "yXl".

- The demangler and remangler continue to support "BO" because it's
  still in use as a type encoding, even if it's not an AST-level
  Type anymore.

- Type-based alias analysis for Builtin.UnknownObject was incorrect,
  so it's a good thing we weren't using it.

- Same with enum layout. (This one assumed UnknownObject never
  referred to an Objective-C tagged pointer. That certainly wasn't how
  we were using it!)
2019-09-26 17:48:04 -07:00
Xi Ge
4069172a40 AST: refactor getLoc() of decls to have a single entry point for all decl kinds, NFC
After we start to serialize the result of getLoc() in the
.swiftsourceinfo file, getLoc() needs a single entry point to look up via
USRs in the serialized format.
2019-09-26 17:47:44 -07:00
swift-ci
7fd05165cd Merge remote-tracking branch 'origin/master' into master-next 2019-09-26 12:50:17 -07:00
swift-ci
349d6b073e Merge remote-tracking branch 'origin/master' into master-rebranch 2019-09-26 12:44:18 -07:00
Harlan Haskins
b904133c42 [Modules] Add flag to skip non-inlinable function bodies
This flag, currently staged in as `-experimental-skip-non-inlinable-function-bodies`, will cause the typechecker to skip typechecking bodies of functions that will not be serialized in the resulting `.swiftmodule`. This patch also includes a SIL verifier that ensures that we don’t accidentally include a body that we should have skipped.

There is still some work left to make sure the emitted .swiftmodule is exactly the same as what’s emitted without the flag, which is what’s causing the benchmark noise above. I’ll be committing follow-up patches to address those, but for now I’m going to land the implementation behind a flag.
2019-09-26 10:40:11 -07:00
swift-ci
6945d6192d Merge remote-tracking branch 'origin/master' into master-next 2019-09-26 09:29:43 -07:00
swift-ci
f809a8790c Merge remote-tracking branch 'origin/master' into master-rebranch 2019-09-26 09:25:07 -07:00
Jordan Rose
8ff1dac381 [AST] Break some header dependencies for faster rebuilds (#27374)
DiagnosticEngine.h no longer depends on Attr.h.
Expr.h no longer depends on TypeRepr.h.

No functionality change.
2019-09-26 09:17:10 -07:00
swift-ci
343ae35dcf Merge remote-tracking branch 'origin/master' into master-rebranch 2019-09-25 21:23:44 -07:00
swift-ci
ec9c2584f0 Merge remote-tracking branch 'origin/master' into master-next 2019-09-25 21:10:17 -07:00
Pavel Yaskevich
10b1baebb2 Merge pull request #27362 from xedin/port-missing-args
[Diagnostics] Port missing argument(s) diagnostics
2019-09-25 21:08:54 -07:00
swift-ci
9c6e8d78ea Merge remote-tracking branch 'origin/master' into master-next 2019-09-25 18:50:31 -07:00
swift-ci
170a84c5bd Merge remote-tracking branch 'origin/master' into master-rebranch 2019-09-25 18:44:16 -07:00
Robert Widmann
dd7d925610 Merge pull request #27364 from CodaFi/raw-smackdown
Clean up enum raw expression validation a bit
2019-09-25 18:43:20 -07:00
swift-ci
9849fe5cc5 Merge remote-tracking branch 'origin/master' into master-next 2019-09-25 13:50:09 -07:00
swift-ci
cb97094e71 Merge remote-tracking branch 'origin/master' into master-rebranch 2019-09-25 13:44:21 -07:00
Robert Widmann
c5a27efe56 Merge pull request #27351 from CodaFi/not-a-good-start-boris
Requestify Operator Precedence Groups and Precedence Group Lookup
2019-09-25 13:30:18 -07:00
Robert Widmann
0df6b40710 Clean up enum raw expression validation a bit
The distinction between the type checked raw value expression and the regular raw value expression was never important.  Downstream clients were ignoring the type checked form and pulling the text out of the supposed "plain" form.  Drop the distinction and simply don't set back into the raw value expr if we don't have to.

Pushing this through naturally enables some cleanup in checkEnumRawValues.  Factor out type checking the literal value into an helper on the typechecker and pull a common diagnostic into the decl checker.
2019-09-25 11:14:47 -07:00
Pavel Yaskevich
cc2c868522 [Diagnostics] Produce a tailored diagnostic for multiple missing arguments 2019-09-24 22:05:14 -07:00
swift-ci
ea4d408732 Merge remote-tracking branch 'origin/master' into master-next 2019-09-24 21:29:40 -07:00
swift-ci
2ff5de58b2 Merge remote-tracking branch 'origin/master' into master-rebranch 2019-09-24 21:24:11 -07:00
Doug Gregor
9b20012ee1 Merge pull request #27322 from DougGregor/property-wrapper-composition-di
[DI] Support definite initialization for composed property wrappers.
2019-09-24 21:22:43 -07:00
swift-ci
76e7b1d2eb Merge remote-tracking branch 'origin/master' into master-next 2019-09-24 20:50:21 -07:00
swift-ci
e010cb4cd4 Merge remote-tracking branch 'origin/master' into master-rebranch 2019-09-24 20:43:47 -07:00
Xi Ge
adb0e6e19f Merge pull request #27277 from nkcsgexi/add-source-info-to-driver
Frontend: set up output file .swiftsourceinfo
2019-09-24 20:34:47 -07:00
Brent Royal-Gordon
97febd42a9 Merge branch 'master' into master-rebranch
# Conflicts:
#	lib/TBDGen/TBDGen.cpp
2019-09-24 18:52:04 -07:00
Robert Widmann
5964ce47b0 Use OperatorPrecedenceGroupRequest to clean up InfixOperatorDecl a bit 2019-09-24 17:45:50 -07:00
Robert Widmann
7d2dac1272 Define Requests
Define the LookupPrecedenceGroupRequest and OperatorPrecedenceGroupRequest for looking up an unvalidated precedence group declaration and retrieving then validating the precedence group associated with an operator.

This allows us to drop both validateDecl overloads for these types out of the TypeChechecker
2019-09-24 17:45:14 -07:00
swift-ci
f9087b0b26 Merge remote-tracking branch 'origin/master' into master-next 2019-09-24 17:30:16 -07:00
Robert Widmann
1ba61d7615 [Gardening] Sort the ASTTypeIDs 2019-09-24 15:40:51 -07:00
swift-ci
e0a9ae468a Merge remote-tracking branch 'origin/master' into master-next 2019-09-24 15:29:49 -07:00
Xi Ge
3103b5cec1 Frontend: set up output file .swiftsourceinfo
This patch will focus on teaching driver and frontend to emit this file.
The actual content and de-serialization parts will come later.

More details: https://forums.swift.org/t/proposal-emitting-source-information-file-during-compilation/28794
2019-09-24 13:52:17 -07:00
Robert Widmann
574a450537 Extensions Do Not Have Parent Signatures
Remove the parent signature from consideration when computing the
generic signature for an extension.  This cuts off a series of crashers
that involved nested extensions with trailing where clauses a la

extension Foo {
  extension Foo where Self.Undefined == Bar {
  }
}

The inner (invalid) extension technically has a parent signature from
Foo itself.  Adding that signature to the GSB means when we go to
register the inner extension's generic parameters we crash.

Since extensions have to occur at the top level, just remove the parent
signature from consideration.

Fixes rdar://55502661
2019-09-24 13:13:51 -07:00
Doug Gregor
81c0a0ea93 [Property wrappers] Allow init(wrappedValue:) initializers with defaulted args
Generalize the type checking when searching for "wrappedValue"
initializers to also allow initializers that have other, defaulted
parameters as well.
2019-09-24 09:11:53 -07:00
Doug Gregor
ab5d161c05 [SILGen] Separate the initialization of a wrapped property from a wrapped value
Teach SILGen to emit a separate SIL function to capture the
initialization of the backing storage type for a wrapped property
based on the wrapped value. This eliminates manual code expansion at
every use site.
2019-09-24 09:11:53 -07:00
swift-ci
7ff0007702 Merge remote-tracking branch 'origin/master' into master-next 2019-09-23 13:09:56 -07:00
swift-ci
b7dd348cd3 Merge remote-tracking branch 'origin/master' into master-rebranch 2019-09-23 13:03:46 -07:00
Pavel Yaskevich
ee8c78eef5 [Diagnostics] Tailored diagnostic when single tuple used instead of N distinct arguments
Diagnose cases when instead of multiple distinct arguments
call got a single tuple argument with expected arity/types:

```swift
func foo(_: Int, _: Int) {}
foo((0, 1)) // expected 2 arguments, got 1 tuple with 2 elements
```
2019-09-23 13:00:37 -07:00
Pavel Yaskevich
96598d8ebf Merge pull request #26207 from owenv/new-vararg-conversion-diag
[Diagnostics] Improve diagnostic when attempting to pass an Array to a variadic argument
2019-09-23 12:57:44 -07:00