⭐️ A friendly language for building type-safe, scalable systems!
295

Configure Feed

Select the types of activity you want to include in your feed.

rephrase 'did you mean one of these' compiler hint for singular scenario

authored by

Zbyněk Juřica and committed by
Louis Pilfold
(Jul 14, 2026, 3:03 PM +0100) 4ff46a57 832ebf81

+24 -19
+6 -1
compiler-core/src/error.rs
··· 3528 3528 // If there are some suggestions about public values in imported 3529 3529 // modules put a "did you mean" text after the main message 3530 3530 if !possible_modules.is_empty() { 3531 - text.push_str("\nDid you mean one of these:\n\n"); 3531 + let message = if possible_modules.len() == 1 { 3532 + "\nDid you mean:\n\n" 3533 + } else { 3534 + "\nDid you mean one of these:\n\n" 3535 + }; 3536 + text.push_str(message); 3532 3537 for module_name in possible_modules { 3533 3538 text.push_str(&format!(" - {module_name}.{name}\n")) 3534 3539 }
+3 -3
compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__errors__same_imports_multiple_times.snap
··· 7 7 8 8 pub fn wobble() { 1 } 9 9 pub fn zoo() { 1 } 10 - 10 + 11 11 12 12 -- main.gleam 13 13 14 14 import gleam/wibble.{wobble} 15 15 import gleam/wibble.{zoo} 16 16 pub fn go() { wobble() + zoo() } 17 - 17 + 18 18 19 19 ----- ERROR 20 20 error: Duplicate import ··· 35 35 │ ^^^ 36 36 37 37 The name `zoo` is not in scope here. 38 - Did you mean one of these: 38 + Did you mean: 39 39 40 40 - wibble.zoo
+1 -1
compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__errors__unknown_variable_suggest_modules_from_the_same_package_with_internal_function.snap
··· 28 28 │ ^^^ 29 29 30 30 The name `add` is not in scope here. 31 - Did you mean one of these: 31 + Did you mean: 32 32 33 33 - module.add
+1 -1
compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__errors__unknown_variable_suggest_modules_from_the_same_package_with_internal_record_constructor.snap
··· 28 28 │ ^^^^^^^^ 29 29 30 30 The custom type variant constructor `MyRecord` is not in scope here. 31 - Did you mean one of these: 31 + Did you mean: 32 32 33 33 - module.MyRecord
+1 -1
compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__errors__unknown_variable_suggest_modules_from_the_same_package_with_internal_type.snap
··· 28 28 │ ^^^ 29 29 30 30 The custom type variant constructor `One` is not in scope here. 31 - Did you mean one of these: 31 + Did you mean: 32 32 33 33 - module.One
+1 -1
compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__errors__unknown_variable_suggest_modules_from_the_same_package_with_internal_value.snap
··· 25 25 │ ^^^ 26 26 27 27 The name `one` is not in scope here. 28 - Did you mean one of these: 28 + Did you mean: 29 29 30 30 - module.one
+1 -1
compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__errors__unknown_variable_suggest_modules_imported_using_an_alias.snap
··· 27 27 │ ^^^ 28 28 29 29 The name `add` is not in scope here. 30 - Did you mean one of these: 30 + Did you mean: 31 31 32 32 - wibble.add
+1 -1
compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__errors__unknown_variable_suggest_modules_with_multiple_segments.snap
··· 27 27 │ ^^^ 28 28 29 29 The name `add` is not in scope here. 30 - Did you mean one of these: 30 + Did you mean: 31 31 32 32 - module.add
+1 -1
compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__errors__unknown_variable_suggest_modules_with_public_function_with_correct_arity_1.snap
··· 26 26 │ ^^^ 27 27 28 28 The name `add` is not in scope here. 29 - Did you mean one of these: 29 + Did you mean: 30 30 31 31 - module.add
+1 -1
compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__errors__unknown_variable_suggest_modules_with_public_function_with_correct_arity_2.snap
··· 26 26 │ ^^^ 27 27 28 28 The name `add` is not in scope here. 29 - Did you mean one of these: 29 + Did you mean: 30 30 31 31 - module.add
+1 -1
compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__errors__unknown_variable_suggest_modules_with_public_function_with_correct_arity_3.snap
··· 26 26 │ ^^^ 27 27 28 28 The name `add` is not in scope here. 29 - Did you mean one of these: 29 + Did you mean: 30 30 31 31 - module.add
+1 -1
compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__errors__unknown_variable_suggest_modules_with_public_function_with_correct_arity_4.snap
··· 27 27 │ ^^^^^^ 28 28 29 29 The name `wibble` is not in scope here. 30 - Did you mean one of these: 30 + Did you mean: 31 31 32 32 - module.wibble
+1 -1
compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__errors__unknown_variable_suggest_modules_with_public_function_with_correct_arity_even_if_arguments_type_mismatch.snap
··· 26 26 │ ^^^ 27 27 28 28 The name `add` is not in scope here. 29 - Did you mean one of these: 29 + Did you mean: 30 30 31 31 - module.add
+1 -1
compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__errors__unknown_variable_suggest_modules_with_public_record_constructor_with_correct_arity.snap
··· 34 34 │ ^^^^^^^^ 35 35 36 36 The custom type variant constructor `MyRecord` is not in scope here. 37 - Did you mean one of these: 37 + Did you mean: 38 38 39 39 - moduletwo.MyRecord
+1 -1
compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__errors__unknown_variable_suggest_modules_with_public_type.snap
··· 27 27 │ ^^^ 28 28 29 29 The custom type variant constructor `One` is not in scope here. 30 - Did you mean one of these: 30 + Did you mean: 31 31 32 32 - module.One
+1 -1
compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__errors__unknown_variable_suggest_modules_with_public_value_1.snap
··· 24 24 │ ^^^ 25 25 26 26 The name `one` is not in scope here. 27 - Did you mean one of these: 27 + Did you mean: 28 28 29 29 - module.one
+1 -1
compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__errors__unknown_variable_suggest_modules_with_public_value_2.snap
··· 27 27 │ ^^^ 28 28 29 29 The name `add` is not in scope here. 30 - Did you mean one of these: 30 + Did you mean: 31 31 32 32 - module.add