Skip to content

Exception thrown when parsing malformed match statement #108

Description

@kjcjohnson

Reported by @panda2134: a gross error message parsing an (invalid) match statement:

    (! (match t0 (
            (($Prod1 v) ...)
            (($Prod2 e1 e2) ...)
            (($Prod3 v t e)) ...   ; <--- note misplaced close paren here
        )) :input (...) :output (...))

This gives:

Unhandled exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.InvalidOperationException: Too many terms to match pattern.
   at Semgus.Parser.Reader.Converters.TermConverter.TryConvertImpl(Type tFrom, Type tTo, Object from, Object& to) in /home/runner/work/Semgus-Parser/Semgus-Parser/ParserLibrary/Reader/Converters/TermConverter.cs:line 367
   at Semgus.Parser.Reader.Converters.SmtConverter.TryConvert(Type tFrom, Type tTo, Object from, Object& to) in /home/runner/work/Semgus-Parser/Semgus-Parser/ParserLibrary/Reader/Converters/SmtConverter.cs:line 77
   at Semgus.Parser.Reader.DestructuringHelper.TryDestructure(ParameterInfo[] paramInfo, IConsOrNil form, Object[]& parameters) in /home/runner/work/Semgus-Parser/Semgus-Parser/ParserLibrary/Reader/DestructuringHelper.cs:line 155
   at Semgus.Parser.Reader.Converters.ConstructorConverter.TryConvertImpl(Type tFrom, Type tTo, Object from, Object& to) in /home/runner/work/Semgus-Parser/Semgus-Parser/ParserLibrary/Reader/Converters/ConstructorConverter.cs:line 33
   at Semgus.Parser.Reader.Converters.SmtConverter.TryConvert(Type tFrom, Type tTo, Object from, Object& to) in /home/runner/work/Semgus-Parser/Semgus-Parser/ParserLibrary/Reader/Converters/SmtConverter.cs:line 77
   at Semgus.Parser.Reader.Converters.SmtConverter.TryConvert[TTarget](Object from, TTarget& to) in /home/runner/work/Semgus-Parser/Semgus-Parser/ParserLibrary/Reader/Converters/SmtConverter.cs:line 105
   at Semgus.Parser.Reader.Converters.TermConverter.TryConvertImpl(Type tFrom, Type tTo, Object from, Object& to) in /home/runner/work/Semgus-Parser/Semgus-Parser/ParserLibrary/Reader/Converters/TermConverter.cs:line 124
   at Semgus.Parser.Reader.Converters.SmtConverter.TryConvert(Type tFrom, Type tTo, Object from, Object& to) in /home/runner/work/Semgus-Parser/Semgus-Parser/ParserLibrary/Reader/Converters/SmtConverter.cs:line 77
   at Semgus.Parser.Reader.Converters.SmtConverter.TryConvert[TTarget](Object from, TTarget& to) in /home/runner/work/Semgus-Parser/Semgus-Parser/ParserLibrary/Reader/Converters/SmtConverter.cs:line 105
   at Semgus.Parser.Commands.FunctionDefinitionCommands.ProcessFunctionDefinition(SmtFunction decl, SmtFunctionRank rank, IEnumerable`1 arguments, SemgusToken token) in /home/runner/work/Semgus-Parser/Semgus-Parser/ParserLibrary/Commands/FunctionDefinitionCommands.cs:line 181
   at Semgus.Parser.Commands.FunctionDefinitionCommands.DefineFunsRec(IList`1 signatures, IList`1 definitions) in /home/runner/work/Semgus-Parser/Semgus-Parser/ParserLibrary/Commands/FunctionDefinitionCommands.cs:line 83
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Span`1& arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
   at Semgus.Parser.Reader.DestructuringHelper.TryDestructureAndInvoke(MethodInfo method, IConsOrNil form, Object instance) in /home/runner/work/Semgus-Parser/Semgus-Parser/ParserLibrary/Reader/DestructuringHelper.cs:line 32
   at Semgus.Parser.SemgusParser.TryParse(ISemgusProblemHandler handler, Int32& errCount, TextWriter errorStream) in /home/runner/work/Semgus-Parser/Semgus-Parser/ParserLibrary/SemgusParser.cs:line 219
   at Semgus.Parser.Program.Execute(ProcessingMode mode, OutputFormat format, Boolean test, String output, HandlerFlags hf, IEnumerable`1 inputs) in /home/runner/work/Semgus-Parser/Semgus-Parser/SemgusParser/Program.cs:line 132
   at Semgus.Parser.Program.<>c__DisplayClass2_0.<Main>b__4(ProcessingMode mode, OutputFormat format, Boolean test, String output, String[] inputs, InvocationContext ctx) in /home/runner/work/Semgus-Parser/Semgus-Parser/SemgusParser/Program.cs:line 95
   at System.CommandLine.Handler.<>c__DisplayClass6_0`6.<SetHandler>b__0(InvocationContext context)
   at System.CommandLine.Invocation.AnonymousCommandHandler.<>c__DisplayClass2_0.<.ctor>g__Handle|0(InvocationContext context)
   at System.CommandLine.Invocation.AnonymousCommandHandler.InvokeAsync(InvocationContext context)
   at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass18_0.<<UseParseErrorReporting>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass13_0.<<UseHelp>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass22_0.<<UseVersionOption>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass20_0.<<UseTypoCorrections>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseSuggestDirective>b__19_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass17_0.<<UseParseDirective>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<RegisterWithDotnetSuggest>b__6_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass9_0.<<UseExceptionHandler>b__0>d.MoveNext()

As usual, absolutely no helpful information here 🙃

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions