Skip to content
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

Fixing various issues of multiblock expressions #822

Merged
merged 8 commits into from
May 30, 2020

Conversation

Mylan719
Copy link
Contributor

While Testing multiblock expressions for use in intellisense of our VS extensions I noticed several imperfections.

  • Two semicolons one just after another are treated as single unknown operator. test;;test If white space is put between the semicolons like so test; ;test it registers as three separate blocks. This is inconsistent. Expected result is: Identifier, Void block, Identifier, grouped into a blocks expression appropriately. This should be the same no matter the white space.

  • Depending on the position of empty block inside a multiblock expression it registers A) test; ;test as an empty identifier or B) test;test; as a void block. This inconsistency should be removed. An empty block should be always represented by void block in the syntax tree.

  • Void block nodes always have 0 start position, wherever they occur. Thereby making it impossible to mark void block related errors correctly.

All these issues are addressed in this pull request. Along with fixing the bugs, I updated the test framework and removed legacy test config. The config, along with old version of test framework prevented me from running tests from VS Test Explorer. I also added new tests for multiblock expressions to check my changes.

@Mylan719 Mylan719 added this to the Version 2.4 milestone Apr 12, 2020
@Mylan719 Mylan719 self-assigned this Apr 12, 2020
Copy link
Member

@exyi exyi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the Test Code : Actual Code ratio 😅

var first = ReadUnsupportedOperatorExpression();
if (Peek() is BindingToken operatorToken && operatorToken.Type == BindingTokenType.Semicolon)
{
Read();
first = CreateVoidBlockIfBlankIdentifier(first, startFirstIndex);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This AFAIK also means that ; test is allowed 🤔

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'd just disallow that, it seems quite suspicious...

@@ -421,6 +434,7 @@ private BindingParserNode ReadAtomicExpression()
else if (token != null && token.Type == BindingTokenType.StringLiteralToken)
{
// string literal

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:/

src/global.json Outdated
"sdk": {
"version": "3.0.100-preview5"
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect! And the CI also seems to be happy without it :)

@tomasherceg tomasherceg merged commit ac78c6b into master May 30, 2020
@tomasherceg tomasherceg deleted the binding-block-fixes branch May 30, 2020 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants