Skip to content

Parser incorrectly infers type of table column with multiple different types #16421

@132ikl

Description

@132ikl

Describe the bug

If you have a table with a column that has at least 3 different inner types, the parser will incorrectly infer the column type as the type of the last value, rather than any. This can be most easily demonstrated by adding a type hint which is obviously incorrect, and seeing how the parser reports the inferred type:

Image

This issue blocks #16079 from being merged

How to reproduce

let expected: nothing = [[item];
  [123],
  [false],
  ["hi"]
]

Expected behavior

The type should be inferred as table<item: any>

Configuration

key value
version 0.106.2-nightly.13
major 0
minor 106
patch 2
pre nightly.13
branch nightly
commit_hash fdda188e6a8f9cbe96dcb1aeeda34861ee6276d4
build_os linux-x86_64
build_target x86_64-unknown-linux-gnu
rust_version rustc 1.86.0 (05f9846f8 2025-03-31)
rust_channel 1.86.0-x86_64-unknown-linux-gnu
cargo_version cargo 1.86.0 (adf9b6ad1 2025-02-28)
build_time 2025-08-12 02:27:49 +00:00
build_rust_channel release
allocator standard
features default, plugin, rustls-tls, sqlite, static-link-openssl, trash-support
installed_plugins custom_values 0.1.0, example 0.105.2, explore_ir 0.6.0, formats 0.105.2, gstat 0.105.2, inc 0.105.2, polars 0.101.1, query 0.105.2, stress_internals 0.105.2
experimental_options example=false, reorder-cell-paths=true

Metadata

Metadata

Assignees

No one assigned

    Labels

    A:parserIssues related to parsingA:type-systemProblems or features related to nushell's type systemcategory:bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions