Skip to content

--foo:bar:baz in config.nims gives wrong results #16946

Open
@timotheecour

Description

@timotheecour

Example 1

# main.nims:
# these work:
--define:"foo3: some def "
switch("hint", "msgOrigin")
switch("hint", "msgOrigin:off")
--hint:msgOrigin

# these don't work:
--define:foo1:bar1 # bug1
# --define:foo2=bar2 # bug2: Error: invalid command line option: '--foo2 = bar2'
# --hint:msgOrigin:off # bug4: Error: 'on' or 'off' expected, but 'msgOrigin:

# main.nim:
when true:
  const foo1 {.strdefine.} = ""
  const foo2 {.strdefine.} = ""
  const foo3 {.strdefine.} = ""
  echo (foo1, foo2, foo3)

nim r --define:foo2=bar2 main

Current Output

("\n bar1", "bar2", " some def ")

Expected Output

("bar1", "bar2", " some def ")

Example 2

likewise with other flags marked as these don't work:

Additional Information

1.5.1 3eebbb2
related recent PR: #16934 which fixed similar issues /cc @Clyybber

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions