Stream: t-compiler/wg-rls-2.0

Topic: Resolving HIR paths

David Lattimore (Jun 30 2020 at 12:06, on Zulip):

I’d like an API like Semantics::resolve_path, but which would accept a path not obtained from Semantics. Supplied paths would all be absolute. Any thoughts on how such an API should look? I just prototyped with a variant fn resolve_path_at(&self, path: &ast::Path, context: &SyntaxNode) -> Option<PathResolution>. My use-case is for adding type constraints on SSR placeholders.

Florian Diebold (Jun 30 2020 at 12:08, on Zulip):

something like that should probably take a HIR path, not an AST path. If the path is always absolute it might be enough to also pass a Crate as context, or maybe it could be a method on Crate

Florian Diebold (Jun 30 2020 at 12:09, on Zulip):

although there's also already resolve_hir_path in SemanticsScope

Florian Diebold (Jun 30 2020 at 12:12, on Zulip):

so... actually I think that should be what you're looking for?

David Lattimore (Jun 30 2020 at 12:21, on Zulip):

Ah, you're right. That does do what I was after. Thanks!

Last update: Sep 27 2020 at 14:30UTC