Skip to content

[QoI] Improve diagnostics for unbound generic types #7178

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 1 commit into from
Feb 7, 2017

Conversation

rintaro
Copy link
Member

@rintaro rintaro commented Feb 1, 2017

Since the subject type can be declared in other modules, we should use the Decl itself instead of its location.

On:

let a : Array

Previously:

test.swift:1:9: error: reference to generic type 'Array' requires arguments in <...>
let a : Array
        ^
             <Any>
<unknown>:0: note: generic type 'Array' declared here

Now:

test.swift:1:9: error: reference to generic type 'Array' requires arguments in <...>
let a : Array
        ^
             <Any>
Swift.Array:281:15: note: generic type 'Array' declared here
public struct Array<Element> : RandomAccessCollection, MutableCollection, _DestructorSafeContainer {
              ^

Since the type is declared in other modules, we should use Decl instead
of its location.

class testStdlibType {
let _: Array // expected-error {{reference to generic type 'Array' requires arguments in <...>}} {{15-15=<Any>}}
}
Copy link
Member Author

@rintaro rintaro Feb 1, 2017

Choose a reason for hiding this comment

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

How can we test this? 🤔

@rintaro
Copy link
Member Author

rintaro commented Feb 1, 2017

@swift-ci Please smoke test

@rintaro
Copy link
Member Author

rintaro commented Feb 4, 2017

Waiting for #7197 to be approved.

@rintaro
Copy link
Member Author

rintaro commented Feb 7, 2017

@swift-ci Please smoke test

@rintaro rintaro merged commit af9d16b into swiftlang:master Feb 7, 2017
@rintaro rintaro deleted the sema-diag-unboundgeneric branch February 9, 2017 06:05
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.

1 participant