maxime-esa / asn1scc

ASN1SCC: An open source ASN.1 compiler for embedded systems

Home Page:https://www.thanassis.space/asn1.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Crash when alternatives of choice have same names but different case

rphh opened this issue · comments

Version:

asn1scc version 4.2.5.1f

Input file:

TEST-FUNCTION-NAMES-DATAVIEW DEFINITIONS ::=
BEGIN

   MyInteger ::= INTEGER (0 .. 10000)

   MyProblem ::= CHOICE {
      first MyInteger,
      fIRST MyInteger
   }

END

Error:

The input sequence was empty. (Parameter 'source')
   at Microsoft.FSharp.Collections.SeqModule.Head[T](IEnumerable`1 source) in D:\a\_work\1\s\src\fsharp\FSharp.Core\seq.fs:line 1375
   at EnsureUniqueEnumNames.CloneChild@40-2.Invoke(FSharpList`1 s, ChildInfo ch) in /home/taste/Github/asn1scc/FrontEndAst/EnsureUniqueEnumNames.fs:line 46
   at CommonTypes.loop@488[d,e,f](FSharpList`1 acc, FSharpFunc`2 func, e state, FSharpList`1 lst) in /home/taste/Github/asn1scc/CommonTypes/CommonTypes.fs:line 492
   at EnsureUniqueEnumNames.CloneType@39-5.Invoke(Asn1Type old, Asn1Module m, FSharpList`1 key, Constructors`1 cons, FSharpList`1 state) in /home/taste/Github/asn1scc/FrontEndAst/EnsureUniqueEnumNames.fs:line 56
   at CloneTree.CloneTypeAssignment[a](TypeAssignment old, Asn1Module m, Constructors`1 cons, a state) in /home/taste/Github/asn1scc/FrontEndAst/CloneTree.fs:line 58
   at CloneTree.defaultConstructors@107-2.Invoke(TypeAssignment old, Asn1Module m, Constructors`1 cons, a state) in /home/taste/Github/asn1scc/FrontEndAst/CloneTree.fs:line 107
   at RemoveParamterizedTypes.loop@30[d,e,f](FSharpList`1 acc, FSharpFunc`2 func, e state, FSharpList`1 lst) in /home/taste/Github/asn1scc/FrontEndAst/RemoveParamterizedTypes.fs:line 34
   at RemoveParamterizedTypes.foldMap[a,b,c](FSharpFunc`2 func, a state, FSharpList`1 lst) in /home/taste/Github/asn1scc/FrontEndAst/RemoveParamterizedTypes.fs:line 38
   at CloneTree.foldMap@25.Invoke(FSharpFunc`2 func, a state, FSharpList`1 lst) in /home/taste/Github/asn1scc/FrontEndAst/CloneTree.fs:line 25
   at CloneTree.CloneModule[a](AstRoot oldRoot, Asn1Module old, Constructors`1 cons, a state) in /home/taste/Github/asn1scc/FrontEndAst/CloneTree.fs:line 44
   at CloneTree.defaultConstructors@106-1.Invoke(AstRoot oldRoot, Asn1Module old, Constructors`1 cons, a state) in /home/taste/Github/asn1scc/FrontEndAst/CloneTree.fs:line 106
   at RemoveParamterizedTypes.loop@30[d,e,f](FSharpList`1 acc, FSharpFunc`2 func, e state, FSharpList`1 lst) in /home/taste/Github/asn1scc/FrontEndAst/RemoveParamterizedTypes.fs:line 34
   at RemoveParamterizedTypes.foldMap[a,b,c](FSharpFunc`2 func, a state, FSharpList`1 lst) in /home/taste/Github/asn1scc/FrontEndAst/RemoveParamterizedTypes.fs:line 38
   at CloneTree.foldMap@25.Invoke(FSharpFunc`2 func, a state, FSharpList`1 lst) in /home/taste/Github/asn1scc/FrontEndAst/CloneTree.fs:line 25
   at CloneTree.CloneAsn1File[a](AstRoot old, Asn1File f, Constructors`1 cons, a state) in /home/taste/Github/asn1scc/FrontEndAst/CloneTree.fs:line 40
   at CloneTree.defaultConstructors@105.Invoke(AstRoot old, Asn1File f, Constructors`1 cons, a state) in /home/taste/Github/asn1scc/FrontEndAst/CloneTree.fs:line 105
   at RemoveParamterizedTypes.loop@30[d,e,f](FSharpList`1 acc, FSharpFunc`2 func, e state, FSharpList`1 lst) in /home/taste/Github/asn1scc/FrontEndAst/RemoveParamterizedTypes.fs:line 34
   at RemoveParamterizedTypes.foldMap[a,b,c](FSharpFunc`2 func, a state, FSharpList`1 lst) in /home/taste/Github/asn1scc/FrontEndAst/RemoveParamterizedTypes.fs:line 38
   at CloneTree.foldMap@25.Invoke(FSharpFunc`2 func, a state, FSharpList`1 lst) in /home/taste/Github/asn1scc/FrontEndAst/CloneTree.fs:line 25
   at EnsureUniqueEnumNames.handleEnumChoices(AstRoot r, EnumRenamePolicy renamePolicy) in /home/taste/Github/asn1scc/FrontEndAst/EnsureUniqueEnumNames.fs:line 69
   at EnsureUniqueEnumNames.DoWork(AstRoot ast) in /home/taste/Github/asn1scc/FrontEndAst/EnsureUniqueEnumNames.fs:line 241
   at FrontEntMain.constructAst_int(CommandLineSettings args, Asn1SccOperationMode op_mode, FSharpFunc`2 debugFnc) in /home/taste/Github/asn1scc/FrontEndAst/FrontEntMain.fs:line 88
   at FrontEntMain.constructAst(CommandLineSettings args, FSharpFunc`2 debugFnc) in /home/taste/Github/asn1scc/FrontEndAst/FrontEntMain.fs:line 114
   at FsUtils.TL[a](String subSystem, FSharpFunc`2 func) in /home/taste/Github/asn1scc/CommonTypes/FsUtils.fs:line 790
   at Program.main0(String[] argv) in /home/taste/Github/asn1scc/asn1scc/Program.fs:line 286

The similar issue for ENUMERATED:

   MyProblem ::= ENUMERATED { one, oNe }

Fixed