Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: convert to different union type crash #254

Merged
merged 2 commits into from
May 4, 2023

Conversation

zhongwencool
Copy link
Contributor

  1. Define a union type union([ref(log_file_handler),map(name, ref(log_file_handler))]
  2. Convert ref(log_file_handler) to map(name, ref(log_file_handler))
  3. Crash
**throw:{#{roots =>
       [{f1,#{converter => #Fun<hocon_tconf_tests.57.87224844>,
              type =>
                  {union,[{ref,hocon_tconf_tests,bar},
                          {map,name,{ref,hocon_tconf_tests,bar}}]}}}]},
 [#{kind => validation_error,
    mismatches =>
        #{"bar" =>
              #{kind => validation_error,path => "f1",
                reason => unknown_fields,unknown => "default",
                unmatched => "host,union_with_default"},
          "name" =>
              #{kind => validation_error,
                location => #{line => 1},
                path => "f1.field1",reason => bad_value_for_struct,
                value => <<"foo1">>}},
    path => "f1",reason => matched_no_union_member}]}
  output:<<"">>

More detail see test/hocon_tconf_tests.erl

src/hocon_tconf.erl Outdated Show resolved Hide resolved
@zhongwencool zhongwencool force-pushed the convert-to-different-type-crash branch from 272786b to 7622aee Compare May 4, 2023 01:52
zhongwencool and others added 2 commits May 4, 2023 09:53
Co-authored-by: Zaiming (Stone) Shi <zmstone@gmail.com>
@zhongwencool zhongwencool force-pushed the convert-to-different-type-crash branch from 7622aee to 946344b Compare May 4, 2023 01:53
@zhongwencool zhongwencool merged commit 1ef1695 into master May 4, 2023
@zhongwencool zhongwencool deleted the convert-to-different-type-crash branch May 4, 2023 07:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants