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
I searched the issues and found no similar issues.
What Happened
During Fix applications Segments are stripped of their position markers which is against the typing of Segments.
However furthermore this caused an issue when attempting to create a fresh tree segment for insertion. In the code base thus far all inserted segments (from a fix) have been raw and not made of a sequence. However when creating a fresh more complex element eg ColumnReference the sequence will throw because it cannot find a position.
This empty position is truly possible and occurs elsewhere in the code base. However simply switching the typing to Optional[PositionMarker] will throw significant static typing errors.
Expected Behaviour
Typing is consistent
There is methodology for creating complex sequences to insert as a fix
Observed Behaviour
Errors thrown when creating unpositioned Segments (for later Fix insertions)
How to reproduce
sequence = [
CodeSegment(raw=table_ref, name="naked_identifier", type="identifier"),
SymbolSegment(raw=".", type="symbol", name="dot"),
CodeSegment(raw=column_name, name="naked_identifier", type="identifier"),
]
# This next line cant execute
new_column = ColumnReferenceSegment(segments=segments, pos_marker=None)
return LintResult(
# Reference the element, not the string.
anchor=anchor,
description=description,
fixes=[ LintFix..create_before(anchor, edit_segments=[new_column]) ]
)
Dialect
NA
Version
0.10.1
Configuration
NA
Are you willing to work on and submit a PR to address the issue?
Search before asking
What Happened
During Fix applications Segments are stripped of their position markers which is against the typing of Segments.
However furthermore this caused an issue when attempting to create a fresh tree segment for insertion. In the code base thus far all inserted segments (from a fix) have been raw and not made of a sequence. However when creating a fresh more complex element eg ColumnReference the sequence will throw because it cannot find a position.
This empty position is truly possible and occurs elsewhere in the code base. However simply switching the typing to
Optional[PositionMarker]
will throw significant static typing errors.Expected Behaviour
Observed Behaviour
Errors thrown when creating unpositioned Segments (for later Fix insertions)
How to reproduce
Dialect
NA
Version
0.10.1
Configuration
NA
Are you willing to work on and submit a PR to address the issue?
Code of Conduct
The text was updated successfully, but these errors were encountered: