[red-knot] trace file when inferring types (#12401) · astral-sh/ruff@f82bb67 (original) (raw)

`@@ -46,9 +46,9 @@ use crate::Db;

`

46

46

`/// scope.

`

47

47

`#[salsa::tracked(return_ref)]

`

48

48

`pub(crate) fn infer_scope_types<'db>(db: &'db dyn Db, scope: ScopeId<'db>) -> TypeInference<'db> {

`

49

``

`-

let _span = tracing::trace_span!("infer_scope_types", ?scope).entered();

`

50

``

-

51

49

`let file = scope.file(db);

`

``

50

`+

let _span = tracing::trace_span!("infer_scope_types", ?scope, ?file).entered();

`

``

51

+

52

52

`// Using the index here is fine because the code below depends on the AST anyway.

`

53

53

`// The isolation of the query is by the return inferred types.

`

54

54

`let index = semantic_index(db, file);

`

`@@ -63,9 +63,10 @@ pub(crate) fn infer_definition_types<'db>(

`

63

63

`db: &'db dyn Db,

`

64

64

`definition: Definition<'db>,

`

65

65

`) -> TypeInference<'db> {

`

66

``

`-

let _span = tracing::trace_span!("infer_definition_types", ?definition).entered();

`

``

66

`+

let file = definition.file(db);

`

``

67

`+

let _span = tracing::trace_span!("infer_definition_types", ?definition, ?file,).entered();

`

67

68

``

68

``

`-

let index = semantic_index(db, definition.file(db));

`

``

69

`+

let index = semantic_index(db, file);

`

69

70

``

70

71

`TypeInferenceBuilder::new(db, InferenceRegion::Definition(definition), index).finish()

`

71

72

`}

`

`@@ -80,9 +81,10 @@ pub(crate) fn infer_expression_types<'db>(

`

80

81

`db: &'db dyn Db,

`

81

82

`expression: Expression<'db>,

`

82

83

`) -> TypeInference<'db> {

`

83

``

`-

let _span = tracing::trace_span!("infer_expression_types", ?expression).entered();

`

``

84

`+

let file = expression.file(db);

`

``

85

`+

let _span = tracing::trace_span!("infer_expression_types", ?expression, ?file).entered();

`

84

86

``

85

``

`-

let index = semantic_index(db, expression.file(db));

`

``

87

`+

let index = semantic_index(db, file);

`

86

88

``

87

89

`TypeInferenceBuilder::new(db, InferenceRegion::Expression(expression), index).finish()

`

88

90

`}

`