You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Expected behavior
The M language specification and the existing Power Query SDK allow a section member to use an exclusive identifier reference to refer to itself (e.g. the SumConsecutive(x - 1) reference in the below example).
section SomeSection;
SumConsecutive = (x) => if x <= 0 then 0 else x + SumConsecutive(x - 1);
Actual behavior
The parser considers the above-mentioned reference an error, complaining that it "cannot find the name 'SumConsecutive'".
To Reproduce
In VSCode, create a new Power Query document. Paste in the above M code. The error shown in the screenshot will then be displayed.
Additional context
Power Query / M Language extension version: v0.1.42
Thank you for your help with this, and for the VSCode extension!
The text was updated successfully, but these errors were encountered:
It is an error for an exclusive-identifier-reference to refer to an identifier that is currently being initialized if the referenced identifier is defined inside a record-initializer-expression or let-expression.
In this issue, the referenced identifier is a section member, so based on the above quote from the language specification (and as discussed in MicrosoftDocs/query-docs#9 (comment)), I believe an exclusive identifier reference (no @) should be considered valid in this case.
I believe you're right in that it's not a requirement on section members. If I had to guess this was a bug in the C# parser that went unnoticed, but in any case it's been shipped for who knows how long so it's now a feature. I'll have to update the scope generation for section members to include both @name and name.
Expected behavior
The M language specification and the existing Power Query SDK allow a section member to use an exclusive identifier reference to refer to itself (e.g. the
SumConsecutive(x - 1)
reference in the below example).Actual behavior
The parser considers the above-mentioned reference an error, complaining that it "cannot find the name 'SumConsecutive'".
To Reproduce
In VSCode, create a new Power Query document. Paste in the above M code. The error shown in the screenshot will then be displayed.
Additional context
Power Query / M Language extension version: v0.1.42
Thank you for your help with this, and for the VSCode extension!
The text was updated successfully, but these errors were encountered: