Skip to content

Commit 579f3fc

Browse files
committed
Update snaps
1 parent d2bde16 commit 579f3fc

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

typechecker/src/type_check/checker.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ impl<'a> TypeChecker<'a> {
3737
match declaration {
3838
Declaration::Variable(v) => {
3939
if let Some(type_annotation) = &v.type_annotation {
40-
self.infer_expr_type(&type_annotation)
40+
type_inference::get_type_from_annotation(type_annotation)
4141
} else if let Some(source) = &v.inferred_type_source {
4242
self.infer_expr_type(&source)
4343
} else {
@@ -46,7 +46,7 @@ impl<'a> TypeChecker<'a> {
4646
}
4747
Declaration::Function(f) => {
4848
if let Some(type_annotation) = f.function_node.returns.clone() {
49-
type_inference::get_type_from_annotation(*type_annotation)
49+
type_inference::get_type_from_annotation(&type_annotation)
5050
} else {
5151
panic!("Infer the type based on the return statement")
5252
}

typechecker/src/type_check/type_inference.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use parser::ast::{self, BinaryOperator};
22

33
use super::types::Type;
44

5-
pub fn get_type_from_annotation(type_annotation: ast::Expression) -> Type {
5+
pub fn get_type_from_annotation(type_annotation: &ast::Expression) -> Type {
66
let expr_type = match type_annotation {
77
ast::Expression::Name(name) => match name.id.as_str() {
88
"int" => Type::Int,

typechecker/testdata/output/typechecker__build__tests__type_check_call.snap.new renamed to typechecker/testdata/output/typechecker__build__tests__type_check_call.snap

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
22
source: typechecker/src/build.rs
3-
assertion_line: 172
43
description: "def function() -> int:\n return 1\n\na = function()\nb = function() + \"1\"\nc = a + 1\nd = function() + 1\n"
54
expression: result
65
---

0 commit comments

Comments
 (0)