Skip to content

Conversation

slavapestov
Copy link
Contributor

@slavapestov slavapestov commented Jun 24, 2016

  • Fix crash when referencing generic typealias from another module (https://bugs.swift.org/browse/SR-1889)
  • Fix crash when generic typealias is declared inside a nested generic type
  • Fix type checking failures when the underlying type of a generic typealias references generic parameters from the outer context
  • Also a small fix for an issue I came across in @discardableResult while working on the above

@slavapestov
Copy link
Contributor Author

@swift-ci Please test and merge

@@ -0,0 +1,9 @@
// RUN: true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you move this test to test/Serialization/ instead, and put the helper file in the Inputs directory? test/multifile/ is supposed to be for intra-module multi-file issues.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've been abusing it lately to cover both intra- and inter-module issues.

Note that some of these tests were not specific to serialization, there were also SILGen issues. I'd rather keep them here as 'integration' tests for our multi-file support.

What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't consider cross-module issues to be multi-file support. The code paths are almost completely different.

Maybe this is just an issue of terminology, but I don't think cross-module tests should be mixed in with intra-module tests, regardless of the directory name.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The thing is a lot of the SILGen issues came up with both cross-file and cross-module things.

What about splitting up test/multifile then?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think in this case the issue is clearly with serialization so the test should be moved there. But I'd like to keep the existing tests in multi-file as is. Sounds reasonable?

@slavapestov slavapestov force-pushed the generic-typealias-fixes branch from 820aca4 to 6ddcf9a Compare June 24, 2016 04:36
@slavapestov
Copy link
Contributor Author

@swift-ci Please test and merge

//

// FIXME: This should work?
typealias OurType = MyType // expected-error {{reference to generic type 'MyType' requires arguments in <...>}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is right to reject this, we want a declaration to be obvious that it is generic, and state its type parameters.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately the qualified lookup case does work, and at least xctest relies on it.

I'd be in favor of making this behavior consistent between the qualified and unqualified cases. It seems like there would be some fallout though.

@lattner
Copy link
Contributor

lattner commented Jun 24, 2016

Thank you for working on this Slava!

…ging to a typealias

The next patch creates a situation where we serialize a reference
to a TypeAliasDecl's GenericParamTypeDecl, which references the
inner DeclContext of the TypeAliasDecl itself. This was not being
deserialized properly, triggering assertions.
…ature

We were forgetting to do this, triggering crashes when using a
generic typealias from another module.

Fixes <https://bugs.swift.org/browse/SR-1889>.
The underlying type can now refer to generic parameters from an
outer context, and we allow qualified and unqualified access to
such typealiases.

One problem remains, with specializations of generic typealiases
in expression parsing context, marked with FIXME in the test.
…d protocols

When we form calls to these methods, the ApplyExpr is wrapped in an
additional conversion. Dig through these to produce the right diagnostic
(or not, if the method is @discardableResult).

Fixes <https://bugs.swift.org/browse/SR-1890>.
@slavapestov slavapestov force-pushed the generic-typealias-fixes branch from 6ddcf9a to beb5018 Compare June 24, 2016 06:15
@slavapestov
Copy link
Contributor Author

@swift-ci Please test and merge

@swift-ci swift-ci merged commit 79446c4 into swiftlang:master Jun 24, 2016
@slavapestov slavapestov deleted the generic-typealias-fixes branch June 28, 2016 04:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants