Entering an incorrect value in place of the expected specific type parameter can cause a parsing exception.
While it's usually an indication of a syntax error (ex: RoundToInteger(1, ()), I encountered this issue with RoundToInteger(1, ((t == 1) ? Rounding.Down : Rounding.Up)), instead of an error related to the fact that the type Rounding can't be stored.
The difference is that in opposition with a syntax error, the method containing the code need to be called to throw the exception.
An exception was thrown while parsing.
System.Exception: Expression tree result is null
at Deltin.Deltinteger.Parse.ExpressionTree.ParseTree(ActionSet actionSet, Boolean expectingValue, Boolean asElement) in PROJECT_PATH\Deltinteger\Deltinteger\Parse\Expression.cs:line 198
at Deltin.Deltinteger.Parse.ExpressionTree.Parse(ActionSet actionSet, Boolean asElement) in PROJECT_PATH\Deltinteger\Deltinteger\Parse\Expression.cs:line 125
at Deltin.Deltinteger.Parse.TernaryConditionalAction.Parse(ActionSet actionSet, Boolean asElement) in PROJECT_PATH\Deltinteger\Deltinteger\Parse\Expression.cs:line 506
at Deltin.Deltinteger.Parse.CodeParameter.Parse(ActionSet actionSet, IExpression expression, Boolean asElement) in PROJECT_PATH\Deltinteger\Deltinteger\Parse\Parameter.cs:line 66
at Deltin.Deltinteger.Parse.CallMethodAction.GetParameterValuesAsWorkshop(ActionSet actionSet) in PROJECT_PATH\Deltinteger\Deltinteger\Parse\CallMethod.cs:line 86
at Deltin.Deltinteger.Parse.CallMethodAction.Parse(ActionSet actionSet, Boolean asElement) in PROJECT_PATH\Deltinteger\Deltinteger\Parse\CallMethod.cs:line 78
at Deltin.Deltinteger.Parse.SetVariableAction.Translate(ActionSet actionSet) in PROJECT_PATH\Deltinteger\Deltinteger\Parse\SetVariable.cs:line 82
at Deltin.Deltinteger.Parse.BlockAction.Translate(ActionSet actionSet) in PROJECT_PATH\Deltinteger\Deltinteger\Parse\Block.cs:line 29
at Deltin.Deltinteger.Parse.DefinedMethod.Parse(ActionSet actionSet, IWorkshopTree[] parameterValues, Object[] additionalParameterData) in PROJECT_PATH\Deltinteger\Deltinteger\Parse\DefinedFunctions.cs:line 220
at Deltin.Deltinteger.Parse.CallMethodAction.Translate(ActionSet actionSet) in PROJECT_PATH\Deltinteger\Deltinteger\Parse\CallMethod.cs:line 73
at Deltin.Deltinteger.Parse.BlockAction.Translate(ActionSet actionSet) in PROJECT_PATH\Deltinteger\Deltinteger\Parse\Block.cs:line 29
at Deltin.Deltinteger.Parse.TranslateRule..ctor(DeltinScript deltinScript, RuleAction ruleAction) in PROJECT_PATH\Deltinteger\Deltinteger\Parse\TranslateRule.cs:line 43
at Deltin.Deltinteger.Parse.DeltinScript.ToWorkshop(Func``2 addRules) in PROJECT_PATH\Deltinteger\Deltinteger\Parse\Translate.cs:line 224
at Deltin.Deltinteger.Parse.DeltinScript..ctor(FileGetter fileGetter, Diagnostics diagnostics, ScriptFile rootRuleset, Func``2 addRules) in PROJECT_PATH\Deltinteger\Deltinteger\Parse\Translate.cs:line 47
at Deltin.Deltinteger.LanguageServer.DocumentHandler.Update() in PROJECT_PATH\Deltinteger\Deltinteger\Language Server\DocumentHandler.cs:line 179
Entering an incorrect value in place of the expected specific type parameter can cause a parsing exception.
While it's usually an indication of a syntax error (ex:
RoundToInteger(1, ())
, I encountered this issue withRoundToInteger(1, ((t == 1) ? Rounding.Down : Rounding.Up))
, instead of an error related to the fact that the type Rounding can't be stored.The difference is that in opposition with a syntax error, the method containing the code need to be called to throw the exception.
Basic code to reproduce:
Thank you for the tool btw !