Given an overload set, attempt to compute a "common type" that
abstracts over all entries in the overload set, providing more
structure for the constraint solver.
We were skipping the diagnostic to allow @IBOutlet to diagnose the
non-Optional type, but we still have to mark our ownership attribute
as invalid so that we don't attempt to form the ReferenceStorageType
with a non-Optional underlying type.
Fixes <https://bugs.swift.org/browse/SR-9889>, <rdar://problem/48088046>.
To correctly call designated super class initializers the designated
intializer (and not the allocator) is dynamically replaceable.
Convenience allocators are dynamically replaceable as before.
This is like '@inlinable', except that the symbol does not have a public
entry point in the generated binary at all; it is deserialized and a copy
is always emitted into the client binary, with shared linkage.
Just like '@inlinable', if you apply this to an internal declaration it
becomes '@usableFromInline' automatically.
This uses the same mechanism as default arguments ever since Swift 4, so
it should work reasonably well, but there are rough edges with diagnostics
and such. Don't use this if you are not the standard library.
Fixes <rdar://problem/33767512>, <https://bugs.swift.org/browse/SR-5646>.
Because initial value expressions aren't actually considered /within/
the VarDecl or PatternBindingDecl they're initializing, the existing
logic to search for availability attributes wasn't kicking in, leading
to errors when a conditionally-unavailable value was used in an
initial value expression for a conditionally-unavailable binding. Fix
this by walking the enclosing type or extension to find the appropriate
PatternBindingDecl.
https://bugs.swift.org/browse/SR-9867
If the access level of a protocol witness does not satisfies a requirement,
the compiler suggests marking it as the required level. This is not suitable
when the witness is in an extension whose specified access level is less than
the required level, since the fixit fights with other warnings in this case.
This patch identifies such case and produces improved diagnostics.
Resolves: SR-9793
Since @autoclosure attribute is associated with declarations
it makes more sense to move diagnostics to where type of the
parameter has been completely resolved. This also helps to support
parameters with typealiases pointing to function types without
any extra logic in the resolver.
While forming/validating parameters make sure that the type is indeed
a function type before marking it as `autoclosure` based on type
representative attributes, because parser doesn't change attributes
even after the error has been found and diagnosed.
Resolves: rdar://problem/47586626
Unlike weak values of optional type, an unowned or unowned(unsafe)
value of optional type will not silently become 'nil' when the
referenced instance goes away: rather, the program will trap. Don't
reject unowned or unowned(unsafe) optional lets.
Fixes rdar://problem/45732251.
We only ever use this in TBDGen and interface printing, and we only ever
generate TBD files or print interfaces for declarations in primary files,
so let's avoid unnecessary work in validateDecl().
Eventually we want validateDecl() to be replaced with a getInterfaceType()
request, so adding new attributes in this path (or other side effects in
general) is a big no-no.
We weren't doing much validation when dynamically replacing storage
declarations, and has an assert() that should be an error. Clean up this
area a bit, dealing with simple ambiguities (i.e., there are two
properties or subscripts with different type signatures; pick the
matching one) and reporting an error when there is a true ambiguity.
Fixes rdar://problem/46737657.
`Int` on Windows x86_64 is different from `Int` on other targets due to
it being a LLP64 target. Explicitly use the `Int32` type for the
enumeration to fix the test.
Create a new capturing substitution for adding a rpath to a target
library. This is needed as Windows doesn't really support the concept
of a rpath. This also makes it possible to remove the parameter from
the command line on windows.
Sema would directly check for the presence of the @objcMembers attribute,
and inherit it from the immediate superclass in validateDecl().
We don't want validateDecl() to have side effects like this and this was
already a problem, because it would not inherit the attribute transitively
in some cases.
Instead, add a ClassDecl::hasObjCMembers() method that walks over all
ancestors and caches the result.
<rdar://problem/46420252>