We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Forge
No response
forge fmt
macOS (Apple Silicon)
forge fmt fails to exit gracefully when dealing with semi-buggy syntax.
the failure:
~/d/r/private on returnable ⨯ forge fmt 18:44:55 The application panicked (crashed). Message: called `Option::unwrap()` on a `None` value Location: /Users/runner/work/foundry/foundry/crates/fmt/src/formatter.rs:2179 This is a bug. Consider reporting it at https://github.com/foundry-rs/foundry ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ⋮ 8 frames hidden ⋮ 9: core::panicking::panic::hc59c8a709a9b37ae at <unknown source file>:<unknown line> 10: core::option::unwrap_failed::h64934fbe08d33633 at <unknown source file>:<unknown line> 11: <forge_fmt::formatter::Formatter<W> as forge_fmt::visit::Visitor>::visit_args::hb3f716b7bade5f75 at <unknown source file>:<unknown line> 12: <forge_fmt::formatter::Formatter<W> as forge_fmt::visit::Visitor>::visit_expr::h398d55c6ef6e37bb at <unknown source file>:<unknown line> 13: forge_fmt::formatter::Formatter<W>::chunked::he8cfb8e49f8a33c9 at <unknown source file>:<unknown line> 14: forge_fmt::formatter::Formatter<W>::items_to_chunks::hf00315ba5eb74268 at <unknown source file>:<unknown line> 15: <forge_fmt::formatter::Formatter<W> as forge_fmt::visit::Visitor>::visit_expr::h398d55c6ef6e37bb at <unknown source file>:<unknown line> 16: forge_fmt::formatter::Formatter<W>::chunked::he8cfb8e49f8a33c9 at <unknown source file>:<unknown line> 17: forge_fmt::formatter::Formatter<W>::visit_list::{{closure}}::h4d9ef04f596ffcd6 at <unknown source file>:<unknown line> 18: forge_fmt::formatter::Formatter<W>::visit_list::ha919796d073ad24e at <unknown source file>:<unknown line> 19: <forge_fmt::formatter::Formatter<W> as forge_fmt::visit::Visitor>::visit_expr::h398d55c6ef6e37bb at <unknown source file>:<unknown line> 20: <solang_parser::pt::Statement as forge_fmt::visit::Visitable>::visit::h2027efd18113fe03 at <unknown source file>:<unknown line> 21: forge_fmt::formatter::Formatter<W>::visit_block::hf6713931e72c9ad5 at <unknown source file>:<unknown line> 22: <solang_parser::pt::Statement as forge_fmt::visit::Visitable>::visit::h2027efd18113fe03 at <unknown source file>:<unknown line> 23: <forge_fmt::formatter::Formatter<W> as forge_fmt::visit::Visitor>::visit_function::hfb269ef5add1d609 at <unknown source file>:<unknown line> 24: <forge_fmt::formatter::Formatter<W> as forge_fmt::visit::Visitor>::visit_contract::{{closure}}::h68ed3e0bcad03f93 at <unknown source file>:<unknown line> 25: forge_fmt::formatter::Formatter<W>::write_lined_visitable::he726da67b4d0729f at <unknown source file>:<unknown line> 26: forge::cmd::fmt::FmtArgs::run::{{closure}}::h10b791fd1bcdb32e at <unknown source file>:<unknown line> 27: rayon::iter::plumbing::bridge_producer_consumer::helper::hd07eb7d7c261e3f1 at <unknown source file>:<unknown line> 28: rayon_core::join::join_context::{{closure}}::h2db7fee0666ccf7c at <unknown source file>:<unknown line> 29: rayon::iter::plumbing::bridge_producer_consumer::helper::hd07eb7d7c261e3f1 at <unknown source file>:<unknown line> 30: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute::hfc6af63177b60cf5 at <unknown source file>:<unknown line> 31: rayon_core::registry::WorkerThread::wait_until_cold::hc2f2f5c5d2ac906c at <unknown source file>:<unknown line> 32: rayon_core::join::join_context::{{closure}}::h2db7fee0666ccf7c at <unknown source file>:<unknown line> 33: rayon::iter::plumbing::bridge_producer_consumer::helper::hd07eb7d7c261e3f1 at <unknown source file>:<unknown line> 34: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute::hfc6af63177b60cf5 at <unknown source file>:<unknown line> 35: rayon_core::registry::WorkerThread::wait_until_cold::hc2f2f5c5d2ac906c at <unknown source file>:<unknown line> 36: std::sys_common::backtrace::__rust_begin_short_backtrace::h26c5ce7ae435c375 at <unknown source file>:<unknown line> 37: core::ops::function::FnOnce::call_once{{vtable.shim}}::h7359e7db922f9b5d at <unknown source file>:<unknown line> 38: std::sys::pal::unix::thread::Thread::new::thread_start::h9266fbbdd0c3d8be at <unknown source file>:<unknown line> 39: __pthread_joiner_wake<unknown> at <unknown source file>:<unknown line> Run with COLORBT_SHOW_HIDDEN=1 environment variable to disable frame filtering. fish: Job 1, 'forge fmt' terminated by signal SIGABRT (Abort)
the cause (semi-buggy syntax):
function test_SetConcept() public { concept.setConcept( "Cool Concept", "Concept description", block.timestamp + 1 days, block.timestamp + 10 weeks, block.timestamp + 2 weeks, 1200, ["concept", "fun", "cool", "wow"], [ConceptGoal({})], <----- buggy line bytes32("test") ); }
The text was updated successfully, but these errors were encountered:
Unable to reproduce this exact error with the given setup, now formats as:
function test_SetConcept() public { concept.setConcept( "Cool Concept", "Concept description", block.timestamp + 1 days, block.timestamp + 10 weeks, block.timestamp + 2 weeks, 1200, ["concept", "fun", "cool", "wow"], [ConceptGoal()], bytes32("test") ); }
Without throwing errors
An alternative invalid setup:
function test_SetConcept() public { concept.setConcept( contract ); }
yields
forge fmt Error: Failed to parse Solidity code for src/Counter.sol. Leaving source unchanged. Context: - failed to parse file: Error: ParserError ╭─[:24:9] │ 24 │ contract │ ────┬─── │ ╰───── unrecognised token 'contract', expected "!", "(", ")", "+", "++", "-", "--", "[", "address", "bool", "byte", "bytes", "case", "default", "delete", "false", "function", "leave", "mapping", "new", "payable", "revert", "string", "switch", "true", "type", "{", "~", Bytes, Int, Uint, address, hexnumber, hexstring, identifier, number, rational, string ────╯ Error: ParserError ╭─[:26:1] │ 26 │ } │ ┬ │ ╰── unrecognised token '}', expected "(", ";", "[", "abstract", "address", "bool", "byte", "bytes", "case", "contract", "default", "enum", "event", "false", "function", "import", "interface", "leave", "library", "mapping", "payable", "pragma", "string", "struct", "switch", "true", "type", "using", Bytes, Int, Uint, address, annotation, hexnumber, hexstring, identifier, number, rational, string ────╯
Feel free to re-open with an alternative minimal reproduction
Sorry, something went wrong.
No branches or pull requests
Component
Forge
Have you ensured that all of these are up to date?
What version of Foundry are you on?
No response
What command(s) is the bug in?
forge fmt
Operating System
macOS (Apple Silicon)
Describe the bug
forge fmt
fails to exit gracefully when dealing with semi-buggy syntax.the failure:
the cause (semi-buggy syntax):
The text was updated successfully, but these errors were encountered: