Commit Graph

9 Commits

Author SHA1 Message Date
Allan Shortlidge
b9262e5297 Sema: Allow default arguments to access @usableFromInline decls.
The restriction that default arguments be disallowed from accessing
`@usableFromInline` decls is overbearing for library developers who need to
write non-trivial code to compute a default value, since it forces them to
either write a verbose closure inline in the function signature or expose a
`public` helper function which unnecessarily expands API surface. A
`@usableFromInline` function a more reasonable way to encapsulate a verbose
default value computation.

This reverses the semantic changes included in https://github.com/apple/swift/pull/15666.

Resolves rdar://112093794.
2023-07-12 12:47:06 -07:00
Anthony Latsis
edd4010664 Gardening: Migrate test suite to GH issues: decl/func 2022-08-26 03:26:32 +03:00
Slava Pestov
998e62005a Sema: Don't diagnose availability errors twice in non-single-expression closures 2019-04-02 20:37:01 -04:00
Slava Pestov
6bb36b5c01 Sema: Subscript default arguments
Fixes <https://bugs.swift.org/browse/SR-6118>.
2019-04-02 20:37:01 -04:00
Mark Lacey
352e4a2de4 [ConstraintSystem] Infer empty closures as returning () more eagerly.
We previously allowed these closures to default to (), but be inferred
as other types as well, which means that we will find some expressions
to be ambiguous because we end up finding multiple viable solutions
where there is really only one reasonable solution.

Fixes: rdar://problem/42337247
2018-09-12 13:30:35 -07:00
Slava Pestov
96901f1983 SE-0193: Public default argument generators cannot reference declarations that are @usableFromInline 2018-04-05 16:56:34 -07:00
Slava Pestov
e1f50b2d36 SE-0193: Rename @_inlineable to @inlinable, @_versioned to @usableFromInline 2018-03-30 21:55:30 -07:00
Slava Pestov
36d43846ea Parse: Relax a recently-added assertion
We parse default argument expressions before building a
FuncDecl, so we might see GenericTypeParamDecls that have
not yet been re-parented to the FuncDecl's context.

Fixes <https://bugs.swift.org/browse/SR-5559>,
<rdar://problem/33539464>.
2017-07-28 21:35:47 -07:00
Slava Pestov
9b2b3b5969 Sema: Don't talk about @_versioned in diagnostics for default arguments
Fixes <rdar://problem/32445206> and
<https://bugs.swift.org/browse/SR-4648>.
2017-06-16 17:00:15 -07:00