TypeCobolTeam / TypeCobol

TypeCobol is an Incremental Cobol parser for IBM Enterprise Cobol 6 for zOS syntax. TypeCobol is also an extension of Cobol 85 language which can then be converted to Cobol85.
Other
78 stars 26 forks source link

Invalid cast in TableDefinitionExtensions.GetTableSortingKeys #2635

Open efr15 opened 4 months ago

efr15 commented 4 months ago

Describe the bug An InvalidCastException has been thrown by TableDefinitionExtensions.GetTableSortingKeys, code was attempting to cast an instance of DataConditionEntry into CommonDataDescriptionAndDataRedefines.

To Reproduce (Type)Cobol code that cause the bug : (if any)

       No code to reproduce yet

Expected behavior No exception !

Technical Check cast instructions and protect where needed.

How to test automatically Standard tests if code to reproduce can be found.

efr15 commented 4 months ago

Stack trace: at TypeCobol.Compiler.Nodes.TableDefinitionExtensions.GetTableSortingKeys(DataDefinition tableDefinition) at TypeCobol.Compiler.Diagnostics.CrossCompleteChecker.gCheckTableSort|16_1(<>c__DisplayClass16_0&) at TypeCobol.Compiler.Diagnostics.CrossCompleteChecker.Visit(Sort sort) at TypeCobol.Compiler.Nodes.Sort.VisitNode(IASTVisitor astVisitor) at TypeCobol.Compiler.Nodes.Node.VisitChildrens(IASTVisitor astVisitor, Boolean continueVisit, IEnumerable1 childrenNodes) at TypeCobol.Compiler.Nodes.Node.VisitChildrens(IASTVisitor astVisitor, Boolean continueVisit, IEnumerable1 childrenNodes) at TypeCobol.Compiler.Nodes.Node.VisitChildrens(IASTVisitor astVisitor, Boolean continueVisit, IEnumerable1 childrenNodes) at TypeCobol.Compiler.Nodes.Node.VisitChildrens(IASTVisitor astVisitor, Boolean continueVisit, IEnumerable1 childrenNodes) at TypeCobol.Compiler.Nodes.Node.VisitChildrens(IASTVisitor astVisitor, Boolean continueVisit, IEnumerable1 childrenNodes) at TypeCobol.Compiler.Nodes.Node.VisitChildrens(IASTVisitor astVisitor, Boolean continueVisit, IEnumerable1 childrenNodes) at TypeCobol.Compiler.Nodes.Node.VisitChildrens(IASTVisitor astVisitor, Boolean continueVisit, IEnumerable`1 childrenNodes) at TypeCobol.Compiler.CompilationUnit.RefreshProgramClassDocumentSnapshot() at TypeCobol.LanguageServer.Workspace.RefreshSyntaxTree(FileCompiler fileCompiler, SyntaxTreeRefreshLevel refreshLevel) at TypeCobol.LanguageServer.Workspace.<>cDisplayClass102_0.g__Refresh|0() at TypeCobol.LanguageServer.TypeCobolServerHost.MessageHandler(IMessageHandler messageHandler, TypeCobolServer typeCobolServer)