14 Commits

Author SHA1 Message Date
Ben Barham
ef8825bfe6 Migrate llvm::Optional to std::optional
LLVM has removed llvm::Optional, move over to std::optional. Also
clang-format to fix up all the renamed #includes.
2024-02-21 11:20:06 -08:00
Nate Chandler
20db2c0981 Merge branch 'main' into rebranch
Conflicts:
	include/swift/Basic/AnyValue.h
2021-01-12 16:30:02 -08:00
Slava Pestov
5585cac9dd AST: Remove AnyValue type eraser now that it's no longer needed
I'm keeping AnyValue.h around, since it has some useful overloads of
hash_value() and simple_display() that don't have a good home at this
time.
2021-01-08 23:17:12 -05:00
Alexis Laferrière
f963465171 Remove hash_value(const llvm::Optional<T> &opt) in favor of LLVM's 2020-12-09 07:38:05 -08:00
Hamish Knight
cb099454d6 Allow SILGen to emit only a specific set of SILDeclRefs
Extend ASTLoweringDescriptor to store a set of
SILDeclRefs to emit through `emitFunctionDefinition`.
2020-09-15 19:20:11 +01:00
Hamish Knight
f081ae51d4 Revert "Revert "Don't heap allocate for active requests""
f8a1ad22e1
2020-01-23 11:03:32 -08:00
Saleem Abdulrasool
f8a1ad22e1 Revert "Don't heap allocate for active requests" 2020-01-23 08:33:31 -08:00
Hamish Knight
35ba3d7316 Fix Optional's simple_display 2020-01-20 09:15:16 -08:00
Joe Groff
fa4dd15612 Sema: Correct composition of property wrappers.
Fixes rdar://problem/53407949 | SR-11138. Previously, we'd only look at the outermost property wrapper to decide whether the wrapped property's getter and setter were `mutating` (or exist at all). In reality, this requires considering the semantics of the composed accesses of each wrapper layer's
`wrappedValue` property. Fixing this systematically addresses a number of issues:

- As SR-11138 reported, composing a nonmutating-get-set wrapper ought to produce a composed wrapper
  that's nonmutating.

- We would previously allow a property wrapper with a mutating getter to be nested inside one with
  only a getter, even though the resulting implementation was unsound (because there's no mutable
  context for the inner wrapper to execute its get on.)

- Similarly, we would construct unsound setters in cases where the setter can't exist, such as when
  the nested wrapper isn't settable but the outer wrapper is.
2019-07-26 16:09:54 -07:00
Doug Gregor
82ed5e9a02 [SE-0258] Implement basic support for property wrapper composition.
When multiple property wrapper attributes are provided on a declaration,
compose them outside-in to form a composite property wrapper type. For
example,

  @A @B @C var foo = 17

will produce

  var $foo = A(initialValue: B(initialValue: C(initialValue: 17)))

and foo's getter/setter will access "foo.value.value.value".
2019-06-13 18:26:29 -07:00
Doug Gregor
346bb99f73 [Evaluator] GraphViz printing for all of the dependencies.
Introduce another form of debugging dump for the evaluator, rendering the
complete dependency graph using GraphViz, including all dependencies and
values cached within the evaluator.
2018-06-01 08:56:18 -07:00
Doug Gregor
d687446e06 [Evaluator] Simplify the definition of new requests and make them printable.
Introduce a CRTP base class, SimpleRequest, which simplifies the task of
defining a new request kind by handling the storage of the values (in a
std::tuple), their hashing, equality, printing, etc. The values are passed
along to the subclass’s operator() so they’re mostly treated as (const)
parameters, making mutation of the request state impossible.

Extend AnyValue and AnyRequest with printing logic, so we can print any
request for debugging purposes, and
2018-06-01 08:56:18 -07:00
Doug Gregor
8886fca400 Address the simple issues raised by Graydon and Huon 2018-06-01 08:56:18 -07:00
Doug Gregor
4ac125f41f [Evaluator] Introduce a simple request evaluator.
Meant as a replacement for the barely-started iterative type checker,
introduce a simpler "evaluator" that can evaluate individual requests
(essentially, function objects with some additional API), caching
results as appropriate and detecting cycles.
2018-06-01 08:56:18 -07:00