Skip to main content

PythonKnowledge

Struct PythonKnowledge 

Source
pub struct PythonKnowledge;
Expand description

Python syntax and static language rules.

Trait Implementations§

Source§

impl LanguageKnowledge for PythonKnowledge

Source§

fn declared_type_is_referent_immutable(&self, _canonical_type: &str) -> bool

Whether a value of this named, resolved declared type cannot have its referent mutated after a check through any reference. Return true only when that guarantee holds; an unmodeled or unknown type answers false. Read more
Source§

fn call_applicability_may_select_callee(&self) -> bool

Whether invocation applicability may select among callee declarations. Languages with applicability-independent binding may keep a positioned callee reference complete while its call obligation remains incomplete. Read by fact_lowering::lower_file_resolution_facts_with_identities (the applicability-gap filter) and the runtime call-rule accessor LoweredCallApplicabilityObligation::argument_independent_binding. The lowering reader stays because it assigns lexical gap coverage when facts are produced; runtime eligibility must not rewrite persisted rows.
Source§

fn callable_result_is_applicability_independent(&self) -> bool

Invocation validity cannot change a callable’s written result type. Binding and result projection retain every other kind of uncertainty.
Source§

fn keyed_property_reads_container_element(&self) -> bool

Property locations represent keyed container elements in this language. This supplies container taint to element reads without proving runtime behavior.
Source§

fn language(&self) -> Language

The Language variant this support serves. Must equal the registry match key.
Source§

fn path_synthetic_module_unit( &self, project: &dyn Project, file: &ProjectFile, ) -> Option<CodeUnit>

The module represented by the file itself, when this language has one. Use the same constructor as the storage adapter’s path module projection. Such a module has no declaration token and navigates to file start; source-declared modules use their ordinary declaration name ranges.
Source§

fn parser_language(&self, _flavor: ParserFlavor) -> Language

This language’s tree-sitter grammar for flavor. The parameter exists for TypeScript, whose .ts and .tsx files parse under distinct grammars while sharing one adapter; every other language answers the same grammar for both.
Source§

fn structural_spec(&self) -> &'static dyn StructuralSpec

This language’s normalized structural-search adapter, the spec query_code runs against.
Source§

fn highlight_query(&self) -> Option<&'static str>

This language’s tree-sitter highlights query, or None when it ships none. Every registered language currently answers Some; the option is here so a future one can be analyzable without shipping highlights instead of returning an empty query that silently produces no captures.
Source§

fn models_compose_from_catalog_rows(&self) -> bool

Compose every semantic-model shard of this language from catalog rows. Row-backed declarations are projected on demand in the bounded store cache.
Source§

fn semantic_string_constant_value(&self, _payload: &str) -> Option<String>

The string value denoted by a ConstantString payload produced by this language. The payload is a language-defined key, not necessarily decoded text. Return None for labels, non-UTF-8 bytes, or other payloads that are not decodable string literals. This is a query-time interpretation; implementations must not change the producer’s payload representation.
Source§

fn guard_condition_syntax(&self) -> Option<&'static GuardConditionSyntax>

Grammar descriptions for languages using shared direct-call guards.
Source§

fn normalize_terminal_name<'a>( &self, name: &'a str, _kind: CodeUnitType, ) -> Cow<'a, str>

Normalize a structurally selected terminal name for possible-callee accounting. This does not change declaration identities or stored facts.
Source§

fn numeric_promotion( &self, _operands: &[Option<&str>], ) -> Option<(IntrinsicTypeKind, &'static str)>

Promote the exact static operand type names for one numeric expression to the intrinsic result type. Names come from selected type descriptors, never source-text parsing.
Source§

fn inferred_local_type_is_initializer_type(&self) -> bool

Whether an inferred local’s static type is exactly its initializer’s type. Later writes must conform to that type but never widen it, so they contribute observed values without feeding the declared type. Languages whose inference reads later writes keep the default.
Source§

fn string_concatenation_operand( &self, _operands: &[Option<&str>], ) -> Option<usize>

Select an operand whose static type proves string concatenation. Other operands need not have known types once this witness exists.
Source§

fn call_may_apply_value(&self) -> bool

Whether an invocation may apply a value selected by lexical or member binding. The declared value type must still prove call applicability.
Source§

fn builtin_supertypes(&self, _spelling: &str) -> Option<BuiltinSupertypes>

The complete supertypes of a builtin type whose supertypes no indexed declaration supplies. A builtin with this answer is a subtype of its own, each aliases and each nominal spelling, of no other builtin spelling, and leaves an open spelling undecided.
Source§

fn native_local_binding_diagnostic(&self) -> bool

Publish the established local-binding diagnostic for a proven native lexical binding that has no indexed declaration unit.
Source§

fn unbound_call_passes_receiver_as_argument(&self) -> bool

Whether an unbound call supplies a target’s instance receiver as its first written actual. The target, not the call’s qualifier, establishes whether an instance receiver exists.
Source§

fn call_target_lookup_routes( &self, ) -> Option<&'static [(u32, ResolutionNamespace)]>

Callee routes for a language that binds the innermost term family before checking invocation. Equal ordinals form one overload set; later routes are fallback bindings, never applicability fallbacks.
Source§

fn generated_items_cannot_shadow_bindings(&self) -> bool

Unexpanded item generators preserve existing authored/imported bindings. Their missing names and potentially generated members remain open.
Source§

fn package_separator(&self) -> &'static str

Separator between a package name and its parent. Only Go and C++ differ from the dotted default.
Source§

fn qualified_call_separator(&self) -> &'static str

The separator this language writes between the segments of a qualified callee path in source: java.net.URLDecoder.decode against std::str::from_utf8. Rust (#2596) and C++ (#2606) write ::; every other language keeps the dotted default. Read more
Source§

fn publishes_single_segment_external_owners(&self) -> bool

Whether this language’s external surface is reached through owners that carry only one segment (#2598). Read more
Source§

fn display_symbol_name(&self, symbol: &str) -> String

How a fully qualified name is spelled for a reader. The default is the indexed spelling itself; the three languages that override strip indexer-only decoration their users never type (Scala’s object $, C#’s generic arity and global:: prefix, TypeScript’s $static static-member marker).
Source§

fn undecorated_fq_name(&self, _fq: &FqName) -> Option<FqName>

The decoration Self::display_symbol_name removes, expressed as a change to the structured name instead of an edit to its rendering. None when fq carries no decoration for this language to remove, which is the common case and costs the caller nothing. Read more
Source§

fn source_identifier<'s>(&self, identifier: &'s str) -> &'s str

How a declaration’s identifier is written at its declaration site, which is what range selection has to match against source text. Same decoration as Self::display_symbol_name removes, applied to a single identifier.
Source§

fn alias_name_segment<'s>(&self, segment: &'s str) -> &'s str

An additional spelling of one symbol-path segment that a query may reasonably use. The default offers no alternative; C# offers the arity-free form, because indexed generic names carry Type`1 and nobody types the arity (#1063).
Source§

fn declaration_name_range(&self, node: Node<'_>, _source: &str) -> Range

The source range of the identifier node carries. The default is the node’s own span; Ruby narrows it, because its symbol literals include a leading : or surrounding quotes that are not part of the name.
Source§

fn symbol_literal_name(&self, _node: Node<'_>, _source: &str) -> Option<String>

The identifier a symbol-literal node names, or None when the node is not one. Only Ruby has a literal form whose text differs from the name it denotes.
Source§

fn call_callee_node<'t>(&self, _call: Node<'t>) -> Option<Node<'t>>

The callee of a call whose grammar names it positionally rather than by field, or None when the generic field lookup already finds it.
Source§

fn field_initializer<'t>(&self, _node: Node<'t>) -> Option<(Node<'t>, Node<'t>)>

The binding target and value of a field initializer or assignment. Shared usage classification decides which side contains a reference; language hooks supply only the grammar shape.
Source§

fn declaration_name_node<'t>(&self, _declaration: Node<'t>) -> Option<Node<'t>>

The identifier a declaration names, for languages whose grammar names it positionally rather than by field, or None when the field lookup or document-order search already finds it.
Source§

fn call_argument_nodes<'t>(&self, _call: Node<'t>) -> Option<Vec<Node<'t>>>

The argument-list nodes of a call whose grammar nests them out of reach of the generic field and child-kind lookup. Some replaces that lookup entirely, so an empty vector means “this call has no arguments”, not “look elsewhere”.
Source§

fn factory_name_node<'t>(&self, _call: Node<'t>) -> Option<Node<'t>>

The identifier naming the callee of a factory call, for languages whose call shape the framework’s per-grammar table cannot express through field lookups alone.
Source§

fn positional_parameter_default<'t>( &self, _parameter: Node<'t>, ) -> Option<Node<'t>>

The default expression of a formal parameter whose grammar does not expose that expression through a named field. None leaves the shared named-field lookup in charge.
Source§

fn skips_local_declaration(&self, _node: Node<'_>, _source: &str) -> bool

Whether node, already recognized as a local declaration by node kind, is one this language’s grammar produces where no local binding exists. C++ says yes for an init_declarator inside a recovered exported class body, where the parse shape of a member declaration is indistinguishable from a local one.
Source§

fn scans_local_declarations_after_focus(&self) -> bool

Whether the lexical resolver must traverse syntax after the focused byte to find declarations that bind earlier source positions. A declaration found there is still accepted only when the engine’s local_declaration_binding_scope hook proves that the current syntax scope owns it.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CapabilityProvider for T
where T: Any,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more