Skip to content

Commit 545f915

Browse files
committed
fix compile
1 parent d32960d commit 545f915

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

compiler/codegen/src/compile.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1666,7 +1666,7 @@ impl Compiler<'_> {
16661666
let key = self.symbol_table_stack.len() - 1;
16671667
let lineno = expr.range().start().to_u32();
16681668

1669-
// Enter scope with the type parameter name (matching CPython)
1669+
// Enter scope with the type parameter name
16701670
self.enter_scope(name, CompilerScope::TypeParams, key, lineno)?;
16711671

16721672
// Compile the expression
@@ -1712,7 +1712,7 @@ impl Compiler<'_> {
17121712
});
17131713

17141714
if let Some(expr) = &bound {
1715-
// Use compile_type_param_bound_or_default for bound (matching CPython)
1715+
// Use compile_type_param_bound_or_default for bound
17161716
let scope_name = if expr.is_tuple_expr() {
17171717
format!("<TypeVar constraint of {}>", name.as_str())
17181718
} else {
@@ -1737,7 +1737,7 @@ impl Compiler<'_> {
17371737

17381738
// Handle default value if present (PEP 695)
17391739
if let Some(default_expr) = default {
1740-
// Use compile_type_param_bound_or_default for default (matching CPython)
1740+
// Use compile_type_param_bound_or_default for default
17411741
let scope_name = format!("<TypeVar default of {}>", name.as_str());
17421742
self.compile_type_param_bound_or_default(default_expr, &scope_name, false)?;
17431743
emit!(
@@ -1764,7 +1764,7 @@ impl Compiler<'_> {
17641764

17651765
// Handle default value if present (PEP 695)
17661766
if let Some(default_expr) = default {
1767-
// Use compile_type_param_bound_or_default for default (matching CPython)
1767+
// Use compile_type_param_bound_or_default for default
17681768
let scope_name = format!("<ParamSpec default of {}>", name.as_str());
17691769
self.compile_type_param_bound_or_default(default_expr, &scope_name, false)?;
17701770
emit!(
@@ -1791,7 +1791,7 @@ impl Compiler<'_> {
17911791

17921792
// Handle default value if present (PEP 695)
17931793
if let Some(default_expr) = default {
1794-
// Use compile_type_param_bound_or_default for default (matching CPython)
1794+
// Use compile_type_param_bound_or_default for default
17951795
// TypeVarTuple allows starred expressions
17961796
let scope_name = format!("<TypeVarTuple default of {}>", name.as_str());
17971797
self.compile_type_param_bound_or_default(default_expr, &scope_name, true)?;

compiler/codegen/src/symboltable.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1368,7 +1368,8 @@ impl SymbolTableBuilder<'_> {
13681368
Ok(())
13691369
}
13701370

1371-
/// Scan type parameter bound or default in a separate scope (matching CPython's symtable_visit_type_param_bound_or_default)
1371+
/// Scan type parameter bound or default in a separate scope
1372+
// = symtable_visit_type_param_bound_or_default
13721373
fn scan_type_param_bound_or_default(&mut self, expr: &Expr, name: &str) -> SymbolTableResult {
13731374
// Enter a new TypeParams scope for the bound/default expression
13741375
// This allows the expression to access outer scope symbols

0 commit comments

Comments
 (0)