From 9d9331f4b083d1ceabbe2ac0f9603cc507ac1db5 Mon Sep 17 00:00:00 2001 From: Greg Shuflin Date: Fri, 26 Nov 2021 02:11:18 -0800 Subject: [PATCH] Add failing test --- schala-lang/src/parsing/combinator.rs | 2 +- schala-lang/src/symbol_table/test.rs | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/schala-lang/src/parsing/combinator.rs b/schala-lang/src/parsing/combinator.rs index 7cd03b3..013dbfd 100644 --- a/schala-lang/src/parsing/combinator.rs +++ b/schala-lang/src/parsing/combinator.rs @@ -616,8 +616,8 @@ fn primary_expr_no_struct(input: Span) -> ParseResult { bool_literal, float_literal, number_literal, - string_literal, self_expr, + string_literal, )), )(input) } diff --git a/schala-lang/src/symbol_table/test.rs b/schala-lang/src/symbol_table/test.rs index 450bb91..2d7bfab 100644 --- a/schala-lang/src/symbol_table/test.rs +++ b/schala-lang/src/symbol_table/test.rs @@ -270,3 +270,20 @@ fn duplicate_struct_members() { ] if type_name == &Fqsn::from_strs(&["Tarak", "Tarak"]) && member == "mets" ); } + +#[test] +fn methods() { + let source = r#" + +type Foo = { x: Int, y: Int } + +impl Foo { + fn hella() { + self.x + 50 + } +} +"#; + let (symbols, _) = add_symbols(source); + symbols.debug(); + assert!(symbols.fq_names.table.get(&make_fqsn(&["hella"])).is_some()); +}