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
GCC Rich Locations #97
Comments
Strictly speaking, a So I think initially you mean to populate the Sorry that I made the naming confusing. |
One concept i think will help out AST and HIR will be to bring in the notion of Spans which rustc uses to solve this. Currently in our type inferencing code there are 2 messages for the case of expected i32 but got bool of example: one warning for the reference location and the other warning for where it was declared which is quite ugly and not right. |
Adding rich location will improve our error message diagnostics, this is an initial building block to keep a wrapper over the GCC stuff we call. Addresses: #97
374: Add basic wrapper over gcc rich_location r=philberty a=philberty Adding rich location will improve our error message diagnostics, this is an initial building block to keep a wrapper over the GCC stuff we call. Addresses: #97 Fixes: #327 Co-authored-by: Philip Herron <philip.herron@embecosm.com>
Adding rich location will improve our error message diagnostics, this is an initial building block to keep a wrapper over the GCC stuff we call. Addresses: #97
374: Add basic wrapper over gcc rich_location r=philberty a=philberty Adding rich location will improve our error message diagnostics, this is an initial building block to keep a wrapper over the GCC stuff we call. Addresses: #97 Fixes: #327 Co-authored-by: Philip Herron <philip.herron@embecosm.com>
690: A bit of 'RichLocation' C++ tuning [#247], [#97, #374] r=philberty a=tschwinge ... in preparation for a merge from GCC upstream, where we otherwise run into several different build errors. Follow-up to commit ed651fc "Add basic wrapper over gcc rich_location". Co-authored-by: Thomas Schwinge <thomas@codesourcery.com>
This relates to something I had thought about doing, but not in enough detail to open an enhancement issue. gcc supports something called "rich locations" in which three actual locations are encoded - a "start" location, a "caret" location, and an "end" location - basically like a location range with a specified value highlighted.
I couldn't find the page that I thought I originally read this in, but here's a quote from here:
Instead of accessing
start_location
andend_location
separately, these could be integrated into a single location value. There's also the technicality that the current definition ofget_closing_locus()
technically gets the beginning location of the last statement rather than the end location of the block (i.e. the right curly bracket), assuming that this would be the preferred behaviour.The lexer would have to be modified to reflect this rich location system, and the parser and AST probably would have to be too (i.e. make a new location from the "start" location from one token and the "end" location of a different one). Also, the backend-independent
Location
abstraction would have to be modified to support this.Originally posted by @SimplyTheOther in #90 (comment)
The text was updated successfully, but these errors were encountered: