Commit Graph

21 Commits

Author SHA1 Message Date
Allan Shortlidge
7e6e8ed7b5 Sema: Fully check the availability of wrappedValue.
Call `checkDeclarationAvailability()`, instead of just diagnosing
unavailability.
2024-10-25 16:50:20 -07:00
Pavel Yaskevich
859106eed1 [Diagnostics] Expand trailing closure failure to handle all closure arguments 2024-01-08 14:09:18 -08:00
Pavel Yaskevich
cd0597186a [CSFix] Allow invalid property wrapper type to be diagnosed in ambiguous context
Adds `diagnoseForAmbiguity` to `AllowInvalidPropertyWrapperType` fix
because it could be attached to a closure parameter that has ambiguity
in the body so it has to be diagnosable in ambiguous contexts.

Resolves: rdar://116522161
2023-11-02 10:18:19 -07:00
Slava Pestov
1957bd6065 Sema: Reword diagnostics to say 'without a type annotation' instead of 'without more context' 2023-06-09 17:44:42 -04:00
Pavel Yaskevich
0b41ea84b9 [CSSimplify] Fix external property wrapper check to use parameter index
Both `ParameterListInfo` and `getParameterAt` expect parameter index
because they operate on a declaration referenced by a call.
2023-04-05 15:53:06 -07:00
Ellie Shin
ef321c9fd2 Allow @usableFromInline and @inlinable to package decls
Add tests for packgae inline
Add more package acl tests

Resolves rdar://104617133
2023-03-16 11:21:11 -07:00
Holly Borla
947a6c32a5 [ConstraintSystem] In the solver, only generate constraints for wrapped
parameter attributes for closure parameters.

For regular function parameters, these constraints will have already been
generated and solved when computing the backing property wrapper type at
the function declaration. If the solver also generates these constraints
when type checking a function call, it leads to misleading diagnostics
about an argument mismatch that will appear at the function declaration
instead of the call-site.
2021-09-02 17:37:44 -07:00
Holly Borla
c297070106 [Diagnostics] Always use the parameter name for closure parameter diagnostics,
because the $ prefix does not indicate that the parameter is anonymous.
2021-05-11 18:30:27 -07:00
Holly Borla
ef58f6a827 [ConstraintSystem] If the contextual parameter type doesn't exist when
resolving a closure, create a new type variable for inferred property
wrapper types.
2021-05-11 18:26:22 -07:00
Holly Borla
d8b5d7d51d [Property Wrapper] For a wrapped parameter that is implementation detail,
make the backing stroage a let-constant.
2021-04-29 12:33:15 -07:00
Holly Borla
0248250a51 [Property Wrappers] Fix a diagnostic crash when a parameter has a wrapped value
mismatch.

If there's an error in property wrapper application, the backing property
wrapper type request will return a null type, which would cause the compiler
to crash because most error recovery code expects ErrorType. If the wrapper
application has an error, use the interface type of the parameter instead.
2021-04-27 12:56:52 -07:00
Holly Borla
b11f465561 [ConstraintSystem] Fix a few diagnostic bugs when an inferred property
wrapper type is a hole or a structural type.
2021-04-15 16:49:25 -07:00
Holly Borla
a11e2455b0 [Property Wrappers] Fixes and tests for inaccessible and unavailable
parameter wrappers.
2021-03-31 09:29:46 -07:00
Holly Borla
76c4c3dc3f [Diagnostics] Add back a dedicated fix/diagnostic for using an invalid
type as a property wrapper.
2021-03-24 11:24:21 -07:00
Holly Borla
f05589f6c4 [Diagnostics] Improve diagnostics for passing an invalid projected
value argument.
2021-03-24 11:24:21 -07:00
Holly Borla
b3d54b67fc [Property Wrappers] Don't allow parameters with attached property wrappers
in protocol requirements.
2021-02-25 18:35:14 -08:00
Holly Borla
db387273f6 [ConstraintSystem] Don't allow dollar prefixes in argument labels unless
the parameter has an attached property wrapper.
2021-02-25 18:35:14 -08:00
Holly Borla
2c2d671dfa [Property Wrappers] Add an unsupported error message for property wrapper
parameters in subscript declarations.
2021-02-25 18:35:14 -08:00
Holly Borla
522eedcfd1 [ConstraintSystem] Emit an error message when trying to pass a property
wrapper projection argument to a wrapped parameter with arguments in the
wrapper attribute.
2021-02-25 18:35:14 -08:00
Holly Borla
ea3fe03c98 [Property Wrappers] Add a constraint fix and diagnostic for the case
where the programmer tries to pass a projection argument to a wrapped
parameter without 'var projectedValue'.
2021-02-25 18:35:14 -08:00
Holly Borla
a4e39688f0 [Property Wrappers] Don't allow property wrappers applied to parameters
to have a mutating wrappedValue getter.
2021-02-25 18:35:14 -08:00