We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Consider printing the following code
int main() { if (true) break; return 0; }
Using my printer, I get the following result.
int main() { if (true) { break; } return (0); }
I expect this to work, as the latter only has an extra set of curly brackets. However, the grading script fails with the following error.
thread 'test_examples_write_c' panicked at 'assertion failed: `(left.is_equiv(right))` left: `TranslationUnit([Node { node: FunctionDefinition(Node { node: FunctionDefinition { specifiers: [Node { node: TypeSpecifier(Node { node: Int, span: 173…176 }), span: 173…176 }], declarator: Node { node: Declarator { kind: Node { node: Identifier(Node { node: Identifier { name: "main" }, span: 177…181 }), span: 177…181 }, derived: [Node { node: KRFunction([]), span: 181…183 }], extensions: [] }, span: 177…183 }, declarations: [], statement: Node { node: Compound([Node { node: Statement(Node { node: If(Node { node: IfStatement { condition: Node { node: Identifier(Node { node: Identifier { name: "true" }, span: 192…196 }), span: 192…196 }, then_statement: Node { node: Break, span: 198…204 }, else_statement: None }, span: 188…207 }), span: 188…207 }), span: 188…207 }, Node { node: Statement(Node { node: Return(Some(Node { node: Constant(Node { node: Integer(Integer { base: Decimal, number: "0", suffix: IntegerSuffix { size: Int, unsigned: false, imaginary: false } }), span: 214…215 }), span: 214…215 })), span: 207…216 }), span: 207…216 }]), span: 184…218 } }, span: 173…218 }), span: 173…218 }])`, right: `TranslationUnit([Node { node: FunctionDefinition(Node { node: FunctionDefinition { specifiers: [Node { node: TypeSpecifier(Node { node: Int, span: 181…184 }), span: 181…184 }], declarator: Node { node: Declarator { kind: Node { node: Identifier(Node { node: Identifier { name: "main" }, span: 185…189 }), span: 185…189 }, derived: [Node { node: KRFunction([]), span: 189…191 }], extensions: [] }, span: 185…191 }, declarations: [], statement: Node { node: Compound([Node { node: Statement(Node { node: If(Node { node: IfStatement { condition: Node { node: Identifier(Node { node: Identifier { name: "true" }, span: 200…204 }), span: 200…204 }, then_statement: Node { node: Compound([Node { node: Statement(Node { node: Break, span: 212…218 }), span: 212…218 }]), span: 206…222 }, else_statement: None }, span: 196…225 }), span: 196…225 }), span: 196…225 }, Node { node: Statement(Node { node: Return(Some(Node { node: Constant(Node { node: Integer(Integer { base: Decimal, number: "0", suffix: IntegerSuffix { size: Int, unsigned: false, imaginary: false } }), span: 233…234 }), span: 232…235 })), span: 225…236 }), span: 225…236 }]), span: 192…238 } }, span: 181…238 }), span: 181…238 }])`',
How to fix this? It seems we do not have enough information to know if the then and else statements are single lined.
then
else
The text was updated successfully, but these errors were encountered:
I found out the problem while writing this question... one should check that the then_statement is a compound to see whether it is single line or not.
then_statement
Sorry, something went wrong.
minseongg
No branches or pull requests
Consider printing the following code
Using my printer, I get the following result.
I expect this to work, as the latter only has an extra set of curly brackets. However, the grading script fails with the following error.
How to fix this? It seems we do not have enough information to know if the
then
andelse
statements are single lined.The text was updated successfully, but these errors were encountered: