Commit Graph

11 Commits

Author SHA1 Message Date
Mike Ash
5decec24e7 [Runtime] Fix gatherWrittenGenericArgs crashing when description is NULL.
rdar://problem/54775582
SR-11374
2019-09-09 10:58:22 -04:00
Harlan Haskins
5a3761df1b [Sema] Stop filtering nested protocol types from lookup
This check wasn't ever correct, because the fact that the the protocol comes
from another module doesn't change the fact that the type is valid for lookup
within this module. It incorrectly rejects the following, valid code:

```swift
// In A.swift
public protocol A {}
```

```
// In B.swift
import A

extension A {
  typealias B = Int
  func b(_ b: Self.B) {}
}
```
2019-06-13 17:54:35 -07:00
Doug Gregor
af335c6bb9 [GSB] Consistently use nested type name match constraints.
We generated a mix of "inferred" and "nested type name match"
constraints for the case where we had two nested types with the same
name and inferred that they are equal. Make them consistent by always
using nested type name match constraints. This fixes a bug where we
would get different canonical generic signatures in different source
files because we inferred the same-type constraint with different
requirement sources.

Fixes rdar://problem/48049725.
2019-02-14 14:28:43 -08:00
Huon Wilson
9a7be78421 [Sema] Give an explicit error for conditional conformances to @objc protocols.
Fixes https://bugs.swift.org/browse/SR-7372.
2018-04-09 09:20:39 +10:00
Huon Wilson
dd845c40d2 [Sema] Disallow conditional conformances on objective-c generics.
There's no way to look up information about objective-c generic
parameters, meaning the runtime cannot check same-type constraints or
conformance requirements, so dynamic casts cannot work. We want to keep
the static and dynamic systems the same, so we have to disable this
functionality from the start (i.e. no conditional conformances on
objective-c types :( ).

Fixes rdar://problem/37524969.
2018-02-15 16:59:03 +11:00
Slava Pestov
d5c2f44c4e Sema: Clean up name lookup and fix a couple of bugs
Previously, qualified lookup would use a metatype to signal
to the LookupResultBuilder that conformance checks should not
be used to resolve protocol members found with a concrete
type base. This is too subtle for my taste. Add an explicit
flag and clean up some usages, fixing <rdar://problem/16123805>.

Also, clean up the 'CheckProtocolMembers' flag. We now set
when the base type is an archetype, and correctly handle
the concept of an abstract conformance. This finally
fixes <rdar://problem/22776964>.
2016-08-09 00:53:30 -07:00
John McCall
6593c5319d Add typo correction to qualified lookup. 2016-07-01 19:04:57 -07:00
Doug Gregor
38c1de69e4 Reinstate "[SR-511][Parse] Add 'associatedtype' keyword and fixit"
This reverts commit ce7b2bcf09, tweaking
a few validation tests appropriately (1 crasher fixed, two -verify
tests that needed updating).
2016-01-14 00:21:48 -08:00
Erik Eckstein
ce7b2bcf09 Revert "[SR-511][Parse] Add 'associatedtype' keyword and fixit"
This reverts commit 2b2e9dc80e.

It broke some compiler crasher tests
2016-01-13 20:42:58 -08:00
gregomni
2b2e9dc80e [SR-511][Parse] Add 'associatedtype' keyword and fixit
Adds an associatedtype keyword to the parser tokens, and accepts either
typealias or associatedtype to create an AssociatedTypeDecl, warning
that the former is deprecated. The ASTPrinter now emits associatedtype
for AssociatedTypeDecls.

Separated AssociatedType from TypeAlias as two different kinds of
CodeCompletionDeclKinds. This part probably doesn’t turn out to be
absolutely necessary currently, but it is nice cleanup from formerly
specifically glomming the two together.

And then many, many changes to tests. The actual new tests for the fixits
is at the end of Generics/associated_types.swift.
2016-01-13 17:54:31 -08:00
Jordan Rose
d3a41b6a78 Add some more tests for inferred associated types.
Filed <rdar://problem/16123805> for the cases that don't work.

Swift SVN r14163
2014-02-20 19:47:44 +00:00