Some editors use diagnostics from SourceKit to replace build issues. This causes issues if the diagnostics from SourceKit are formatted differently than the build issues. Make sure they are rendered the same way, removing most uses of `DiagnosticsEditorMode`.
To do so, always emit the `add stubs for conformance` note (which previously was only emitted in editor mode) and remove all `; add <something>` suffixes from notes that state which requirements are missing.
rdar://129283608
Added a test that builds two dynamic libraries and sets up a redundant protocol
conformance (we use dynamic libraries because the compiler will normally reject
redundant conformances), then checks that when we rely on it, we get a warning
message.
Formal access alone does not take into account @testable imports of
internal types. This prevented otherwise valid conditional conformances
of these types from compiling.
rdar://72875683
"Function builders" are being renamed to "result builders". Add the
corresponding `@resultBuilder` attribute, with `@_functionBuilder` as
an alias for it, Update test cases to use @resultBuilder.
EmittedMembersRequest needs a stable order for synthesized members
to ensure that vtable layout is computed consistently across frontend
jobs. This used to use the mangled name as the sort key.
However, the mangling includes the type of all outer contexts, and if
an outer type is a closure, we would need to compute the type of the
closure. Computing the type of a closure might require type checking
its body though, which would in turn type check the local class, which
would invoke EmittedMembersRequest, introducing a cycle.
Instead, let's use the DeclName and string-ified type as the sort key.
This is simpler to compute than th mangled name, and breaks the cycle.
Fixes <rdar://problem/67842221>.
Otherwise, we would generate inconsistent vtable layouts for classes
with static properties that have attached wrappers. The reason is that
we normally force synthesis of the backing storage and storage wrapper
for each instance property wrapper as part of computing the lowered
stored properties.
However, there was no such forcing for static properties. But since a
static stored property (with an attached wrapper or otherwise) must be
'final', the real fix is to just ensure that the 'final' bit propagates
to the storage wrapper as well.
The backing storage property was already always final, so the issue
did not arise there.
Fixes <rdar://problem/59522703>, <https://bugs.swift.org/browse/SR-12429>.
There was a logic error causing us to place nominal types on the
DeclsToFinalize list in the specific case where they were members
of an extension of a class.
Of course this kind of thing is indicative of bad design, and now,
the whole DeclsToFinalize list is gone. Let's add a regression
test for posterity.
* [TypeChecker] Enclosing stubs protocol note within editor mode
* [test] Removing note from test where there is no -diagnostics-editor-mode flag
* Formatting modified code
* [tests] Fixing tests under validation-tests
Make sure we test checkObjCWitnessSelector() in the multi-file
case.
I made some changes that regressed a source compatibility project
but the regression was not caught by our test suite, so make sure
we have a test for this now.
When checking availability of referenced accessors, we may not have
synthesized the accessors yet. This meant that we didn't diagnose
references to internal(set) properties from inlinable contexts if
the property was defined in another file.
Instead of adding a resolveDeclSignature() call here, I'm going to live
dangerously and try to only get the enum element type in the case where
SIL type lowering has already computed it, that is, if the enum is not
indirect.
Soon this will become moot anyway because getInterfaceType() will be a
request.
Under non-editor mode, the fixit for inserting protocol stubs is associated with a note
pointing to the missing protocol member declaration which could stay in a separate file from
the conforming type, leading to the behavior of rdar://51534405. This change checks if
the fixit is in a separate file and issues another note to carry the fixit if so.
rdar://51534405
Fix a bug with cross-file uses of the synthesized _foo/$foo for
properties with attached wrappers by implicitly triggering the
appropriate synthesis during name lookup.
Fixes rdar://problem/51725203.
Turn the generic CustomAttrTypeRequest into a helper function and
introduce a FunctionBuilderTypeRequest that starts from a ParamDecl.
This has better caching characteristics and also means we only need to
do a single cache lookup in order to resolve the type in the normal path.
It also means we don't need as much parameterization in the cache.
In addition, check that the parameter has function type in the request,
not just when late-checking the attribute, and add a check that it isn't
an autoclosure.
The protocol requirement storage declaration might not have accessors
created for it if it was incorrectly declared as a 'let' property
inside the protocol.
There might be other cases where we had failed to synthesize the
requirement's accessors, and crash here; this should hopefully make
all of those more robust.
Fixes <rdar://problem/48994271>.
PE/COFF does not include a symbol table in the generated executable
binary. Instead, use `public` to expose the getter, and then use
`-coff-exports` from `llvm-readobj` to get the symbols that are
exported. Fortunately, the same tool can be used to list the symbol
table contents for ELF and MachO binary. This allows us to share the
test across all the targets.
If we computed captures before completing a lazy getter body, we would fail to
consider the 'self' capture properly. Instead make it resilient to such ordering
issues by checking in capture computation if the lazy property has a getter yet
or not.
We were trying to do this when synthesizing the getter prototype, but
we don't do that immediately when we're just type-checking a reference
to the storage, which could lead to the reference thinking that the
getter was non-mutating.
Fixes rdar://45712204.
Before adding implicit initializers synthesizes a new initializer, make sure that
we’ve validated the current class declaration to determine it’s generic signature.
Fixes rdar://problem/44235762.
Fixes the non-WMO crash in ReactiveCocoa (SR-8530), where IRGen was
attempting to fulfill a metadata request based on a nominal type whose
layout was not checked.
Once you’ve called a function and retrieved a result, IRGen will want
layout information for the result type. Make sure that the type checker
precomputes it.
When we reference a member of a class extension, we need to
compute its overrides, @objc bit, and ‘dynamic’ status because SILGen
may rely on them. Do that consistently by adding such members to the
list of declarations to “finalize”.
Rework the finalization logic to handle the computation of each of those
bits, and never remove a finalized declaration from the set: rather,
process new declarations as they enter the set, to avoid looping or
extra state bits.
Fixes rdar://problem/42440686.
When computing the type of a potentially-overriden declaration, make sure
we have an interface type. Add a test to ensure that we validate
overrides cross-file correctly.
They're not used inside the thunk so it's a waste passing them in, and
if they involve private types from a different translation unit we will
get a linking error from referencing the metadata accessor function.
Fixes the test case in <rdar://problem/39470607>, but the more general
problem remains.