Skip to content

[SR-197] Skip generic specialization when generic is <<error type>> #450

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 18, 2015

Conversation

EliaCereda
Copy link
Contributor

This disables the 'cannot specialize non-generic type' error message when the type is <<error type>> since it doesn't convey any additional information to the user.

This code represents an instance of this problem:

$ cat a.swift 
typealias SomeType = NonExistentType
func foo(bar: SomeType<Int>) {

}
$ swiftc -c  a.swift 
a.swift:1:22: error: use of undeclared type 'NonExistentType'
typealias SomeType = NonExistentType
                     ^~~~~~~~~~~~~~~
a.swift:2:15: error: cannot specialize non-generic type '<<error type>>'
func foo(bar: SomeType<Int>) {

This would be the first time I contribute code to Swift, so I might have made some rookie mistake. In particular, from what I saw on the discussion of #432, this might not be the place where the problem should be addressed.

I'm currently running the test suite, but I think it should pass since I haven't found any test checking this particular case. Should one be added?

EDIT: the tests just finished:

  Expected Passes    : 2350
  Expected Failures  : 5
  Unsupported Tests  : 34

@lattner lattner assigned lattner and DougGregor and unassigned lattner Dec 17, 2015
@lattner
Copy link
Contributor

lattner commented Dec 17, 2015

Sorry for the delay reviewing this. The patch looks great to me. Please add a test case to the test suite though.

@EliaCereda
Copy link
Contributor Author

This seems to cover the issue. I think that's the right place where this should be tested, since that's the part that tests typealias SomeType = NonExistentType

lattner added a commit that referenced this pull request Dec 18, 2015
[SR-197] Skip generic specialization when generic is <<error type>>
@lattner lattner merged commit 0c8b0a3 into swiftlang:master Dec 18, 2015
@lattner
Copy link
Contributor

lattner commented Dec 18, 2015

Looks great, thanks. Please close SR-197 when you get a chance,

-Chris

freak4pc pushed a commit to freak4pc/swift that referenced this pull request Sep 28, 2022
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.

3 participants