Skip to content

Commit

Permalink
Fix passing slice for determining literal value
Browse files Browse the repository at this point in the history
  • Loading branch information
Glyphack committed Nov 8, 2023
1 parent 45e34e5 commit e7f3523
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions typechecker/src/type_check/type_inference.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ pub fn get_type_from_annotation(type_annotation: &ast::Expression) -> PythonType
fn handle_literal_type(s: &Subscript) -> PythonType {
// Only simple parameters are allowed for literal type:
// https://peps.python.org/pep-0586/#legal-and-illegal-parameterizations
//
let value = get_literal_value_from_param(&s.value.clone());
let value = get_literal_value_from_param(&s.slice.clone());
if value.len() > 1 {
todo!("MultiValue literal type is not supported yet")
}
Expand All @@ -89,6 +88,7 @@ fn handle_literal_type(s: &Subscript) -> PythonType {
/// the LiteralValue of the parameter.
/// Literal values might contain a tuple, that's why the return type is a vector.
pub fn get_literal_value_from_param(expr: &Expression) -> Vec<LiteralValue> {
log::debug!("Getting literal value from param: {:?}", expr);
let val = match expr {
Expression::Constant(c) => {
match c.value.clone() {
Expand Down

0 comments on commit e7f3523

Please sign in to comment.