Incorrect position of error reported from macro in inline methods chain
See original GitHub issueThis issue is based on scalameta/metals#3214
The position of error that was produced in inline context is unwrapped to the outermost one. In case if it’s a chain of inline calls, it’s unclear where the actual error happens.
Example:
// InlineMac.scala
object InlineMac:
inline def sample(inline expr: String): Int =
${ sampleImpl('expr) }
def sampleImpl(expr: Expr[String])(using Quotes): Expr[Int] =
import quotes.reflect.*
report.errorAndAbort("Error", expr)
// Main.scala
object Main:
def main(args: Array: String): Unit =
inline def v2 = InlineMac.sample("foo") // <- the actual error position was here
inline def v1 = v2
v2 // [error] Error <- reported error position is here - wrong
There is a difference between in error message between direct compiler usage and using bsp-client.
The default compiler reportee additionally adds lines like: This location contains code that was inlined from Main.scala:27
but I don’t think that it helps a lot in this case.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:9
- Comments:11 (7 by maintainers)
Top Results From Across the Web
VBA Error Handling - A Complete Guide - Excel Macro Mastery
Compilation errors occur over more than one line. The syntax is correct on a single line but is incorrect when all the project...
Read more >Crate error_chain - Docs.rs
A library for consistent and reliable error handling. error-chain makes it easy to take full advantage of Rust's powerful error handling features without ......
Read more >Weird macro recursive inline limit infinite loop bug/crash #11730
I have made the issue circe/circe#1695, which is about the useless error message their macro code generates in a given scenario – it's...
Read more >C Preprocessor Macro with 2 arguments issue - Stack Overflow
This function formats the message and reports it on standard error, determining time and date if appropriate. It also exits (hence the _Noreturn ......
Read more >List of the armcc error and warning messages - Arm Developer
The ARM Compiler Errors and Warnings Reference Guide provides lists of the errors and warnings that each of the compilation tools can generate....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@tgodzik The plan was to extend the diagnostic structure to carry this additional info for inline error, but I haven’t had time to prototype this thing yet.
Thanks for all your work @nicolasstucki, @dos65 and @tgodzik! Being able to display error underlines on specific terms is super exciting for me!