Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • SWIFTsim SWIFTsim
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 57
    • Issues 57
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 18
    • Merge requests 18
  • Deployments
    • Deployments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • SWIFT
  • SWIFTsimSWIFTsim
  • Issues
  • #445
Closed
Open
Issue created Jul 24, 2018 by Matthieu Schaller@matthieuOwner

Subtle parser bug

We stumbled upon a "fun" parser-related bug with @jwillis earlier today. We both have more grey hair now. Let me try to describe it in a general way. The specific problem appears in the velociraptor branch.

Let's say that we read the quantity foo:bar with the optional value 1. The value is not present in the file, so the parameter gets assigned the value 1. The code then records this value in the parser structure such that it can be dumped in the used_parameters.yml diagnostics file. So far so good.

Let's now have a second piece of code that reads foo:bar again but this time with default value 2. That value is still not in the file. However, this time the parser will not return 2 but it will return the 1 (i.e. the default value coming from the first call). This is because we recorded having read that 1 without storing that we did not in fact read it but defaulted to the default value.

That behaviour is not desirable as it does not match what we would expect the code to do. So, we should either prevent users from reading a given value twice (or more) or make sure that the second time we read a value, we do not return the default of the 1st call but the actual default we pass in.

@pdraper you may enjoy that bug as well. 😃

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking