cases causing type inference interference
The following KSY represents the current state of my project:
```ksy
enums:
  rec_types:
    1: fileheader
    2: filetrailer
    3: data
meta:
  endian: le
  id: kscbug
  title: Demonstrate a type inference bug
seq:
- id: fileheader
  type: fileheader
- doc: Having this reference satisfies type deduction requirements; the conditional
    allows us to defer reading it.
  id: records
  if: false
  type: record
types:
  record:
    seq:
    - id: type
      type: u1
    - id: length
      type: u1
    - id: payload
      type:
        cases:
          0x39: filemiddlething  # Remove this line for "empty.reduceLeft" error
          _:    payload_bytes
        switch-on: type
    - id: trailer
      type: u1
      if: type != 0x39 and type != 0xff
  payload_bytes:
    doc:  This is a place-holder type -- if we reference the "payload" type directly, then we lose lazy evaluation.
    seq:
      - size: _parent.length
  payload:
    params:
    - doc: receive the type as an int to work around a bug in KSC V0.8
      id: rec_type_int
      type: u1
    instances:
      rec_type:
        doc:  convert the int to the proper enum for the switch
        value: rec_type_int
        enum: rec_types
    seq:
    - id: data
      type:
        cases:
          rec_types::data: data
          rec_types::fileheader: fileheader
          rec_types::filetrailer: filetrailer
        switch-on: rec_type
  fileheader:
    seq:
    - id: fmt
      type: u4
  filetrailer:
    seq:
    - id: cnt
      type: u4
  filemiddlething:
    seq:
    - size: 2
  data:
    seq:
    - id: fld
      type: u4
```
Unfortunately, the C++ code which KSC generates for it doesn't compile:
```console
$ ksc -t cpp_stl --outdir ~/tmp ~/tmp/kscbug3.ksy 
$ c++ -c -I/opt/kaitai_struct_cpp_stl_runtime kscbug.cpp 
kscbug.cpp:47:22: error: no matching constructor for initialization of
      'kscbug_t::fileheader_t'
        m_data = new fileheader_t(m__io, this, m__root);
                     ^            ~~~~~~~~~~~~~~~~~~~~
./kscbug.h:139:9: note: candidate constructor not viable: no known conversion
      from 'kscbug_t::payload_t *' to 'kscbug_t *' for 2nd argument
        fileheader_t(kaitai::kstream* p__io, kscbug_t* p__parent = 0, ks...
        ^
./kscbug.h:135:11: note: candidate constructor (the implicit copy constructor)
      not viable: requires 1 argument, but 3 were provided
    class fileheader_t : public kaitai::kstruct {
          ^
kscbug.cpp:152:21: error: assigning to 'kscbug_t::filemiddlething_t *' from
      incompatible type 'kscbug_t::payload_bytes_t *'
        m_payload = new payload_bytes_t(m__io, this, m__root);
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.
```

It looks like something in the first `cases` map is interfering with the type inference for `fileheader` (which is referenced both from the main `seq` and from the `payload` type, which have no type in common) such that it gets declared expecting a `kscbug_t` as a parent instead of a `kaitai::kstruct` (which causes problems for the `payload_t` type).  

Strangely, `data_t` and `filetrailer_t` don't seem to get the proper parent -- they are expecting a `kaitai::kstruct` when I think they should be expecting a `payload_t`.

And then, for whatever reason, `filemiddlething_t` is (properly) expecting a `record_t` but it's being handed a `payload_bytes_t`.