Skip to content

6b5d14c3 breaks resolution of runtime error locations in macros #1191

@efd6

Description

@efd6

Describe the bug

We use the NodeID() value from runtime errors to be able to locate runtime errors in programs. The change in 6b5d14c (identified by git bisect) appears to have broken this for nodes that exist within the AST in macro expansions. After the change, errors are noted as existing at the site of the unexpanded macro, rather than at the site within the macro's body.

For example with the following program:

get(state.url).Body.decode_json().records.map(r,
	get(state.url+'/'+r.id).Body.decode_json()).as(events, {
//                    ^~~~ r.id not converted to string: can't add integer to string.
		"events": events,
})

note that in this context, state.url is a dyn that is not known until runtime.

(before):

failed eval: ERROR: <input>:3:26: no such overload
 |   get(state.url+'/'+r.id).Body.decode_json()).as(events, {
 | .........................^

(after):

failed eval: ERROR: <input>:5:14: no such overload
 |    "events": events,
 | .............^

Neither is perfect, but the one after the change is worse.

To Reproduce
Check which components this affects:

  • parser
  • checker
  • interpreter

Test setup:

Best done by reference to github.com/elastic/mito@48813c5bbc46326feb15c8aab98cb08bae2c1fa6 and the corresponding test adjustment in github.com/elastic/mito@6bd3ded032c5cd2bb44ca0aad50a14a80e736857

I can put together a smaller reproducer, but I'd like to get an idea of whether this is something that we just have to live with before I do that>

Expected behavior

Something more similar to the "before" case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions