From bb36f23605c320e28475d52558d7ed99af9f3402 Mon Sep 17 00:00:00 2001 From: Knut Wannheden Date: Fri, 4 Dec 2026 06:39:40 +0100 Subject: [PATCH 1/3] Name no defining module for a symbol its scope only imports Under includeSymbols, a reference to an import ty cannot follow (`from lib import gone` with `lib` declaring no `gone`, or `import nosuchmod`) falls back to the import's own definition, so it was described as the importing module's symbol: `definedIn: "m"`, `qualifiedName: "m.gone"`. An import declares nothing in the scope it stands in, and a client trusting those fields attributed `gone()` to `m` instead of falling back to the import. Such a symbol now keeps its id and carries only `name`, the shape a file outside any module already gets. A name the scope also binds some other way (a def, class or assignment) is still that scope's symbol. Every definition of the name in its scope is considered, so the description, sent once per session, does not depend on which reference was met first. Plain includeBindings is unchanged: it already gave such a reference no binding. --- README.md | 4 +++- src/collector.rs | 19 ++++++++++++++-- tests/integration/main.rs | 46 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 66 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 65ef152b3..9743954d9 100644 --- a/README.md +++ b/README.md @@ -262,7 +262,7 @@ Under `includeSymbols`, a binding names a variable rather than describing it: `{ | Field | Type | Description | |---|---|---| | `name` | `string` | The variable's name | -| `definedIn` | `string` | Module holding the variable, as in `BindingInfo`. Absent for a file that resolves to no module, such as `my-script.py` | +| `definedIn` | `string` | Module holding the variable, as in `BindingInfo`. Absent for a file that resolves to no module, such as `my-script.py`, and for a name its scope only imports | | `qualifiedName` | `string` | As in `BindingInfo`. Absent with `definedIn` | An id stands for a variable, not an assignment: two references share an id exactly when they read the same variable, whichever assignment reaches each. `x = 1` and `x = 2` in one scope are one variable. Two functions' locals named `r` are two, even where their `qualifiedName`s coincide, as for a property's getter and setter. Key a variable by its id, not by `qualifiedName`. @@ -271,6 +271,8 @@ Ids hold for the session. Like a type descriptor, a symbol is described only in Every kind of variable resolves: parameters, loop and `with` and `except` targets, walrus and comprehension variables, and match captures, besides what `BindingInfo` covers. A parameter's declaration node carries the same id as its uses. A `global` or `nonlocal` name, and a closure's read of an enclosing variable, get the id of the scope that owns the variable. An attribute assigned only in a method body (`self.x = ...`) is no variable and has no binding. Where the class body also binds `x`, `self.x`, `obj.x` and `C.x` all name that class variable. +A reference to an imported name gets the symbol of the definition the import names. Where ty cannot follow the import (`from lib import gone` with `lib` declaring no `gone`, or `import nosuchmod`), it gets the importing scope's symbol instead, described by `name` alone: an import declares nothing in the scope it stands in. A name the scope also binds some other way — a `def`, a class, an assignment — is that scope's symbol and carries `definedIn` and `qualifiedName`, so in module `m`, `try: from lib import gone` / `except ImportError: def gone(): ...` makes `gone` `m.gone`. Every definition of the name in its scope counts, so the description does not depend on which reference a session meets first. + Over a 71-file project, a symbol binding with its share of the table costs about 63 bytes against 120 for a `BindingInfo`. `includeSymbols` reports 75% more bindings than `includeBindings` and still adds slightly less payload: 19% over no bindings, against 20%. ### CallSignatureInfo diff --git a/src/collector.rs b/src/collector.rs index 0f419dceb..0b8fcd563 100644 --- a/src/collector.rs +++ b/src/collector.rs @@ -9,8 +9,8 @@ use ruff_text_size::Ranged; use ty_python_core::ProgramFile; use ty_python_core::definition::{Definition, DefinitionKind}; use ty_python_core::place::ScopedPlaceId; -use ty_python_core::place_table; use ty_python_core::symbol::ScopedSymbolId; +use ty_python_core::{place_table, use_def_map}; use ty_python_semantic::types::call::CallArguments; use ty_python_semantic::types::call::bind::CheckTypesMode; use ty_python_semantic::types::constraints::ConstraintSetBuilder; @@ -654,7 +654,9 @@ fn describe_symbol<'db>( ) -> SymbolInfo { let scope = definition.scope(db); let name = place_table(db, scope).symbol(symbol).name().to_string(); - let defined_in = module_name_of(db, env, definition.file(db)); + let defined_in = declared_in_its_scope(db, definition) + .then(|| module_name_of(db, env, definition.file(db))) + .flatten(); let qualified_name = defined_in.is_some().then(|| { let mut components = qualified_name_components_from_scope(db, scope); components.push(name.clone()); @@ -667,6 +669,19 @@ fn describe_symbol<'db>( } } +/// Whether the scope of `definition` binds its variable other than by import, since +/// an import declares nothing where it stands. Every definition in the scope counts, +/// so the answer does not depend on which one a session met first. +fn declared_in_its_scope<'db>(db: &'db dyn Db, definition: Definition<'db>) -> bool { + let place = definition.place(db); + use_def_map(db, definition.scope(db)) + .definitions_with_usage() + .any(|(_, other, _)| { + let kind = other.kind(db); + other.place(db) == place && kind.is_user_visible() && !kind.is_import() + }) +} + fn expr_kind_name(expr: &ast::Expr) -> &'static str { match expr { ast::Expr::BoolOp(_) => "ExprBoolOp", diff --git a/tests/integration/main.rs b/tests/integration/main.rs index a233d6b05..cee449df0 100644 --- a/tests/integration/main.rs +++ b/tests/integration/main.rs @@ -3348,6 +3348,52 @@ fn a_file_outside_any_module_still_gets_symbols() { assert_eq!(symbol_entry(script, x), serde_json::json!({"name": "x"})); } +#[test] +fn an_import_ty_cannot_follow_names_no_defining_module() { + let results = symbol_results( + &[ + ("lib.py", "def present():\n return 1\n"), + ( + "m.py", + concat!( + "from lib import gone\n", + "import nosuchmod\n", + "gone()\n", + "gone()\n", + "nosuchmod.f()\n", + ), + ), + ], + &["m.py"], + ); + let m = &results[0]; + for name in ["gone", "nosuchmod"] { + let id = one_symbol(m, name); + assert_eq!(symbol_entry(m, id), serde_json::json!({"name": name})); + } +} + +#[test] +fn a_name_both_imported_and_declared_is_defined_where_it_is_declared() { + // The first reference reaches only the import, so the symbol is first met there. + let results = symbol_results( + &[ + ("lib.py", "def present():\n return 1\n"), + ( + "m.py", + "from lib import gone\ngone()\ndef gone():\n pass\ngone()\n", + ), + ], + &["m.py"], + ); + let m = &results[0]; + let gone = one_symbol(m, "gone"); + assert_eq!( + symbol_entry(m, gone), + serde_json::json!({"name": "gone", "definedIn": "m", "qualifiedName": "m.gone"}), + ); +} + #[test] fn one_shot_symbols_takes_precedence_over_bindings() { let dir = create_test_project(&[("m.py", "x = 1\nprint(x)\n")]); From c55f9940dbf805c3de82fd490d3638b035624c67 Mon Sep 17 00:00:00 2001 From: Knut Wannheden Date: Fri, 4 Dec 2026 07:01:19 +0100 Subject: [PATCH 2/3] Give an unfollowed import a symbol of its own Describing one symbol per place cannot match each reference when the place mixes an import ty cannot follow with a real binding. In from lib import gone gone() def f(a=(gone := 1)): pass the call reaches only the failed import, yet the walrus binds `gone` at module scope, so the shared symbol claimed `definedIn: "m"` for it. The registry key now carries whether the definition is an import. Any import reaching `symbol_binding` is one `resolve_definition` could not follow, so that key gets a name-only entry, and references the import reaches no longer share an id with the place's other bindings. This replaces the scan over the scope's definitions. Under includeSymbols, an assignment, loop, `with` or walrus target now resolves to the definition it creates. Matching by type picked an earlier binding whose type the scope also holds, which an unfollowed import's `Unknown` always is. The same pick gave `X = 2` after `from a import X` the id of `a.X`, and the reads after it `m.X`'s. Plain includeBindings is unchanged: both changes apply only under includeSymbols. --- README.md | 6 ++-- src/collector.rs | 60 ++++++++++++++++++++++++++++----------- src/symbols.rs | 6 +++- tests/integration/main.rs | 18 ++++++++---- 4 files changed, 64 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 9743954d9..82f851bbb 100644 --- a/README.md +++ b/README.md @@ -262,16 +262,16 @@ Under `includeSymbols`, a binding names a variable rather than describing it: `{ | Field | Type | Description | |---|---|---| | `name` | `string` | The variable's name | -| `definedIn` | `string` | Module holding the variable, as in `BindingInfo`. Absent for a file that resolves to no module, such as `my-script.py`, and for a name its scope only imports | +| `definedIn` | `string` | Module holding the variable, as in `BindingInfo`. Absent for a file that resolves to no module, such as `my-script.py`, and for an import ty cannot follow | | `qualifiedName` | `string` | As in `BindingInfo`. Absent with `definedIn` | -An id stands for a variable, not an assignment: two references share an id exactly when they read the same variable, whichever assignment reaches each. `x = 1` and `x = 2` in one scope are one variable. Two functions' locals named `r` are two, even where their `qualifiedName`s coincide, as for a property's getter and setter. Key a variable by its id, not by `qualifiedName`. +An id stands for a variable, not an assignment: two references share an id exactly when they read the same variable, whichever assignment reaches each, except for an import ty cannot follow, described below. `x = 1` and `x = 2` in one scope are one variable. Two functions' locals named `r` are two, even where their `qualifiedName`s coincide, as for a property's getter and setter. Key a variable by its id, not by `qualifiedName`. Ids hold for the session. Like a type descriptor, a symbol is described only in the first response that mentions it, so a client keeps the table it has received. Every kind of variable resolves: parameters, loop and `with` and `except` targets, walrus and comprehension variables, and match captures, besides what `BindingInfo` covers. A parameter's declaration node carries the same id as its uses. A `global` or `nonlocal` name, and a closure's read of an enclosing variable, get the id of the scope that owns the variable. An attribute assigned only in a method body (`self.x = ...`) is no variable and has no binding. Where the class body also binds `x`, `self.x`, `obj.x` and `C.x` all name that class variable. -A reference to an imported name gets the symbol of the definition the import names. Where ty cannot follow the import (`from lib import gone` with `lib` declaring no `gone`, or `import nosuchmod`), it gets the importing scope's symbol instead, described by `name` alone: an import declares nothing in the scope it stands in. A name the scope also binds some other way — a `def`, a class, an assignment — is that scope's symbol and carries `definedIn` and `qualifiedName`, so in module `m`, `try: from lib import gone` / `except ImportError: def gone(): ...` makes `gone` `m.gone`. Every definition of the name in its scope counts, so the description does not depend on which reference a session meets first. +A reference to an imported name gets the symbol of the definition the import names. Where ty cannot follow the import (`from lib import gone` with `lib` declaring no `gone`, or `import nosuchmod`), the import is a symbol of its own, described by `name` alone, since it declares nothing in the scope it stands in. A name that scope also binds some other way is a second symbol, with `definedIn` and `qualifiedName`. In module `m`, `from lib import gone` / `gone()` / `gone = None` / `gone()` gives the first call the import's id, and the assignment target and the second call `m.gone`'s. A reference both reach, as after `try: from lib import gone` / `except ImportError: def gone(): ...`, gets the one `BindingInfo` resolves to, which is the one first in the source. Over a 71-file project, a symbol binding with its share of the table costs about 63 bytes against 120 for a `BindingInfo`. `includeSymbols` reports 75% more bindings than `includeBindings` and still adds slightly less payload: 19% over no bindings, against 20%. diff --git a/src/collector.rs b/src/collector.rs index 0b8fcd563..61e54c4ae 100644 --- a/src/collector.rs +++ b/src/collector.rs @@ -9,8 +9,8 @@ use ruff_text_size::Ranged; use ty_python_core::ProgramFile; use ty_python_core::definition::{Definition, DefinitionKind}; use ty_python_core::place::ScopedPlaceId; +use ty_python_core::place_table; use ty_python_core::symbol::ScopedSymbolId; -use ty_python_core::{place_table, use_def_map}; use ty_python_semantic::types::call::CallArguments; use ty_python_semantic::types::call::bind::CheckTypesMode; use ty_python_semantic::types::constraints::ConstraintSetBuilder; @@ -193,6 +193,12 @@ impl<'db> TypeCollector<'db, '_, '_> { .filter_map(only_definition) .collect(); + if matches!(self.bindings, BindingMode::Symbols(_)) + && let Some(created) = self.definition_created_at(expr, &candidates) + { + return Some(created); + } + // A symbol another module binds under `if sys.platform == ...` reaches here as // one definition per branch, in source order and unfiltered by reachability. // The live branch is the one matching the type this file binds the symbol to, @@ -214,6 +220,29 @@ impl<'db> TypeCollector<'db, '_, '_> { } } + /// The definition an assignment, loop, `with` or walrus target creates, so that + /// the target and the reads it reaches share one symbol. Matching by type would + /// pick an earlier binding of the name whose type the scope also holds, as an + /// unfollowed import's `Unknown` always is. + fn definition_created_at( + &self, + expr: &ast::Expr, + candidates: &[Definition<'db>], + ) -> Option> { + let db = self.db; + let ast::Expr::Name(name) = expr else { + return None; + }; + if !name.ctx.is_store() { + return None; + } + let module = ruff_db::parsed::parsed_module(db, self.model.python_file()).load(db); + candidates.iter().copied().find(|definition| { + definition.program_file(db) == self.model.program_file() + && definition.kind(db).target_range(&module) == name.range() + }) + } + fn named_binding(&self, definition: Definition<'db>) -> Option { let db = self.db; Some(BindingInfo::Named { @@ -234,8 +263,17 @@ impl<'db> TypeCollector<'db, '_, '_> { let BindingMode::Symbols(symbols) = &mut self.bindings else { return None; }; - let key = (definition.file(db), definition.file_scope(db), place); - let symbol_id = symbols.intern(key, || describe_symbol(db, env, definition, symbol)); + // `resolve_definition` follows every import it can, so one reaching here it could not. + let unfollowed_import = definition.kind(db).is_import(); + let key = ( + definition.file(db), + definition.file_scope(db), + place, + unfollowed_import, + ); + let symbol_id = symbols.intern(key, || { + describe_symbol(db, env, definition, symbol, unfollowed_import) + }); Some(BindingInfo::Symbol { symbol_id }) } @@ -651,10 +689,11 @@ fn describe_symbol<'db>( env: &ProgramEnvironment<'db>, definition: Definition<'db>, symbol: ScopedSymbolId, + unfollowed_import: bool, ) -> SymbolInfo { let scope = definition.scope(db); let name = place_table(db, scope).symbol(symbol).name().to_string(); - let defined_in = declared_in_its_scope(db, definition) + let defined_in = (!unfollowed_import) .then(|| module_name_of(db, env, definition.file(db))) .flatten(); let qualified_name = defined_in.is_some().then(|| { @@ -669,19 +708,6 @@ fn describe_symbol<'db>( } } -/// Whether the scope of `definition` binds its variable other than by import, since -/// an import declares nothing where it stands. Every definition in the scope counts, -/// so the answer does not depend on which one a session met first. -fn declared_in_its_scope<'db>(db: &'db dyn Db, definition: Definition<'db>) -> bool { - let place = definition.place(db); - use_def_map(db, definition.scope(db)) - .definitions_with_usage() - .any(|(_, other, _)| { - let kind = other.kind(db); - other.place(db) == place && kind.is_user_visible() && !kind.is_import() - }) -} - fn expr_kind_name(expr: &ast::Expr) -> &'static str { match expr { ast::Expr::BoolOp(_) => "ExprBoolOp", diff --git a/src/symbols.rs b/src/symbols.rs index 173165379..59807b0bf 100644 --- a/src/symbols.rs +++ b/src/symbols.rs @@ -9,7 +9,11 @@ use crate::protocol::{SymbolId, SymbolInfo}; /// A variable: the place a scope of a file binds. Every assignment to `x` in one /// scope shares it, unlike the salsa id of a `Definition`, which is per assignment /// and may change between revisions. -pub type SymbolKey = (File, FileScopeId, ScopedPlaceId); +/// +/// The flag marks an import ty could not follow. It declares nothing where it +/// stands, so references reaching it get a symbol apart from the place's other +/// bindings, one without a defining module. +pub type SymbolKey = (File, FileScopeId, ScopedPlaceId, bool); /// Gives each variable a session-stable id, and reports each symbol's description /// only in the first response that mentions it. diff --git a/tests/integration/main.rs b/tests/integration/main.rs index cee449df0..cfec7ac1e 100644 --- a/tests/integration/main.rs +++ b/tests/integration/main.rs @@ -3374,22 +3374,30 @@ fn an_import_ty_cannot_follow_names_no_defining_module() { } #[test] -fn a_name_both_imported_and_declared_is_defined_where_it_is_declared() { - // The first reference reaches only the import, so the symbol is first met there. +fn a_failed_import_and_another_binding_of_the_name_get_separate_symbols() { let results = symbol_results( &[ ("lib.py", "def present():\n return 1\n"), ( "m.py", - "from lib import gone\ngone()\ndef gone():\n pass\ngone()\n", + "from lib import gone\ngone()\ndef f(a=(gone := 1)):\n pass\ngone\n", ), ], &["m.py"], ); let m = &results[0]; - let gone = one_symbol(m, "gone"); + // The call reaches only the import. The walrus target and the last read are the + // walrus's, which binds at module scope. + let ids = symbol_ids(m, "ExprName", "gone"); + let (imported, bound) = (ids[0].unwrap(), ids[1].unwrap()); + assert_ne!(imported, bound); + assert_eq!(ids, [Some(imported), Some(bound), Some(bound)]); assert_eq!( - symbol_entry(m, gone), + symbol_entry(m, imported), + serde_json::json!({"name": "gone"}) + ); + assert_eq!( + symbol_entry(m, bound), serde_json::json!({"name": "gone", "definedIn": "m", "qualifiedName": "m.gone"}), ); } From 318d1e960da1b1daae7e7937ee62082bea51c981 Mon Sep 17 00:00:00 2001 From: Knut Wannheden Date: Fri, 4 Dec 2026 07:12:23 +0100 Subject: [PATCH 3/3] Spell lambda, comprehension and type-params scopes in symbol names ty's `qualified_name_components_from_scope` spells only class and function scopes. A symbol bound in any other scope read as a module member under includeSymbols: a lambda parameter `c` as `m.c`, a comprehension variable `x` as `m.x`, and the type param of `class C[gone]` as `m.gone`, so a reference to it looked like one to a module-level `gone`. Symbol names now spell those scopes, keeping ty's spelling for class and function scopes: m..c m..x m..gone A type-params scope is spelled only for its own type params. It also encloses the generic class's or function's body, whose names keep their current spelling (`m..a` in `def f[T](a: T)`). BindingInfo and type descriptors keep ty's spelling. Their bindings are functions, classes, type aliases and assignments, which only live in module, class and function scopes. --- README.md | 2 +- src/collector.rs | 61 +++++++++++++++++++++++++++++++++++++-- tests/integration/main.rs | 36 +++++++++++++++++++++++ 3 files changed, 95 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 82f851bbb..49913f2b2 100644 --- a/README.md +++ b/README.md @@ -263,7 +263,7 @@ Under `includeSymbols`, a binding names a variable rather than describing it: `{ |---|---|---| | `name` | `string` | The variable's name | | `definedIn` | `string` | Module holding the variable, as in `BindingInfo`. Absent for a file that resolves to no module, such as `my-script.py`, and for an import ty cannot follow | -| `qualifiedName` | `string` | As in `BindingInfo`. Absent with `definedIn` | +| `qualifiedName` | `string` | As in `BindingInfo`, with lambda and comprehension scopes spelled too, and a type param's own scope: `m..c`, `m..x`, `m..T`. Absent with `definedIn` | An id stands for a variable, not an assignment: two references share an id exactly when they read the same variable, whichever assignment reaches each, except for an import ty cannot follow, described below. `x = 1` and `x = 2` in one scope are one variable. Two functions' locals named `r` are two, even where their `qualifiedName`s coincide, as for a property's getter and setter. Key a variable by its id, not by `qualifiedName`. diff --git a/src/collector.rs b/src/collector.rs index 61e54c4ae..3d71f9f01 100644 --- a/src/collector.rs +++ b/src/collector.rs @@ -9,8 +9,9 @@ use ruff_text_size::Ranged; use ty_python_core::ProgramFile; use ty_python_core::definition::{Definition, DefinitionKind}; use ty_python_core::place::ScopedPlaceId; -use ty_python_core::place_table; +use ty_python_core::scope::NodeWithScopeKind; use ty_python_core::symbol::ScopedSymbolId; +use ty_python_core::{place_table, semantic_index}; use ty_python_semantic::types::call::CallArguments; use ty_python_semantic::types::call::bind::CheckTypesMode; use ty_python_semantic::types::constraints::ConstraintSetBuilder; @@ -696,8 +697,9 @@ fn describe_symbol<'db>( let defined_in = (!unfollowed_import) .then(|| module_name_of(db, env, definition.file(db))) .flatten(); - let qualified_name = defined_in.is_some().then(|| { - let mut components = qualified_name_components_from_scope(db, scope); + let qualified_name = defined_in.as_ref().map(|module| { + let mut components = vec![module.clone()]; + components.extend(symbol_scope_components(db, definition)); components.push(name.clone()); components.join(".") }); @@ -708,6 +710,59 @@ fn describe_symbol<'db>( } } +/// The scopes between the module and the variable `definition` binds, outermost +/// first. Class and function scopes read as ty spells them in `qualifiedName`. +/// A type-params scope reads only for its own type params, since it also encloses +/// the generic class's or function's body, whose names ty spells without it. +fn symbol_scope_components<'db>(db: &'db dyn Db, definition: Definition<'db>) -> Vec { + let module = ruff_db::parsed::parsed_module(db, definition.python_file(db)).load(db); + let index = semantic_index(db, definition.program_file(db)); + let own = definition.file_scope(db); + let mut components: Vec = index + .ancestor_scopes(own) + .filter_map(|(id, scope)| match scope.node() { + NodeWithScopeKind::Module | NodeWithScopeKind::TypeAlias(_) => None, + NodeWithScopeKind::Class(class) => Some(class.node(&module).name.to_string()), + NodeWithScopeKind::Function(function) => Some(format!( + "", + function.node(&module).name + )), + NodeWithScopeKind::Lambda(_) => Some("".to_string()), + NodeWithScopeKind::ListComprehension(_) => { + Some("".to_string()) + } + NodeWithScopeKind::SetComprehension(_) => { + Some("".to_string()) + } + NodeWithScopeKind::DictComprehension(_) => { + Some("".to_string()) + } + NodeWithScopeKind::GeneratorExpression(_) => { + Some("".to_string()) + } + _ if id != own => None, + NodeWithScopeKind::ClassTypeParameters(class) => Some(format!( + "", + class.node(&module).name + )), + NodeWithScopeKind::FunctionTypeParameters(function) => Some(format!( + "", + function.node(&module).name + )), + NodeWithScopeKind::TypeAliasTypeParameters(alias) => { + let alias = alias.node(&module); + let name = alias + .name + .as_name_expr() + .map_or("", |name| name.id.as_str()); + Some(format!("")) + } + }) + .collect(); + components.reverse(); + components +} + fn expr_kind_name(expr: &ast::Expr) -> &'static str { match expr { ast::Expr::BoolOp(_) => "ExprBoolOp", diff --git a/tests/integration/main.rs b/tests/integration/main.rs index cfec7ac1e..e2472b11c 100644 --- a/tests/integration/main.rs +++ b/tests/integration/main.rs @@ -3348,6 +3348,42 @@ fn a_file_outside_any_module_still_gets_symbols() { assert_eq!(symbol_entry(script, x), serde_json::json!({"name": "x"})); } +#[test] +fn a_symbol_in_a_lambda_comprehension_or_type_params_scope_names_that_scope() { + let results = symbol_results( + &[( + "m.py", + concat!( + "lam = lambda c: [x for x in c]\n", + "s = {e for e in lam([])}\n", + "d = {k: 1 for k in s}\n", + "g = (y for y in d)\n", + "def f[T](a: T) -> T:\n", + " return a\n", + "class C[U]:\n", + " item: U\n", + "type A[V] = list[V]\n", + ), + )], + &["m.py"], + ); + let m = &results[0]; + for (name, expected) in [ + ("c", "m..c"), + ("x", "m...x"), + ("e", "m..e"), + ("k", "m..k"), + ("y", "m..y"), + ("T", "m..T"), + ("a", "m..a"), + ("U", "m..U"), + ("V", "m..V"), + ] { + let id = one_symbol(m, name); + assert_eq!(symbol_entry(m, id)["qualifiedName"], expected, "{name}"); + } +} + #[test] fn an_import_ty_cannot_follow_names_no_defining_module() { let results = symbol_results(