Skip to content

[CSApply] Fix a case where CSApply produced an invalid DeclRefExpr #31398

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
Apr 29, 2020

Conversation

hborla
Copy link
Member

@hborla hborla commented Apr 29, 2020

When re-writing an UnresolvedDotExpr to a resolved member reference, check if the member is a type reference and build a TypeExpr before checking if the base is a module and building a simple DeclRefExpr. Otherwise, CSApply could produce invalid DeclRefExprs for a type reference, which will crash later on in SILGen.

Resolves: rdar://problem/61450069

check if the member is a type reference and build a TypeExpr _before_
checking if the base is a module and building a simple DeclRefExpr.
@hborla hborla requested a review from xedin April 29, 2020 15:07
@hborla
Copy link
Member Author

hborla commented Apr 29, 2020

@swift-ci please smoke test

@hborla hborla merged commit cd96282 into swiftlang:master Apr 29, 2020
@hborla hborla deleted the invalid-decl-ref-expr branch April 29, 2020 17:53

// CHECK: declref_expr type='module<SomeModule>'
// CHECK-NEXT: type_expr type='Data.Type'
let type = SomeModule.Data.self
Copy link
Contributor

Choose a reason for hiding this comment

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

@brentdax You might be interested in this example because, from how @hborla described this to me it appears that SomeModule.Data lookup would produce multiple results here - one for SomeModule.Data and one for Foundation.Data which seems like a bug in shadowing resolution?

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.

2 participants