mirror of
https://github.com/nushell/nushell.git
synced 2025-06-08 11:06:55 +02:00
**Title**: Better error handling for negative integer exponents in `**` operator --- ### Bug Fix This PR addresses an issue where attempting to raise an integer to a negative power (e.g. `10 ** -1`) incorrectly triggered an `OperatorOverflow` error. This behavior was misleading since the overflow isn't actually the root problem — it's the unsupported operation of raising integers to negative powers. --- ### Fix Summary * Updated `Value::pow` to: * Check for negative exponents when both operands are integers. * Return a `ShellError::IncorrectValue` with a helpful message guiding users to use floating point values instead. #### Example: ```bash > 10 ** -1 Error: nu:🐚:incorrect_value × Incorrect value. ╝─[entry #2:1:4] 1 │ 10 ** -1 · ─┬┬ · │╰── encountered here · ╰── Negative exponent for integer power is unsupported; use floats instead. ``` --- ### Testing Manual testing: * `10 ** -1` → now returns a clear and appropriate `IncorrectValue` error. * `10.0 ** -1`, `10 ** -1.0`, etc. continue to work as expected. --- ### Related Fixes #15860 --------- Co-authored-by: Kumar Ujjawal <kumar.ujjawal@greenpista.com>
Nushell core libraries and plugins
These sub-crates form both the foundation for Nu and a set of plugins which extend Nu with additional functionality.
Foundational libraries are split into two kinds of crates:
- Core crates - those crates that work together to build the Nushell language engine
- Support crates - a set of crates that support the engine with additional features like JSON support, ANSI support, and more.
Plugins are likewise also split into two types:
- Core plugins - plugins that provide part of the default experience of Nu, including access to the system properties, processes, and web-connectivity features.
- Extra plugins - these plugins run a wide range of different capabilities like working with different file types, charting, viewing binary data, and more.