Skip to content

Commit

Permalink
cr: shorter err message
Browse files Browse the repository at this point in the history
  • Loading branch information
yoav-steinberg committed Jul 20, 2023
1 parent 09c3b9d commit 2779a94
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 2 additions & 2 deletions examples/tests/invalid/super_call.w
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ class B extends A {
static static_method() {
// super doesn't make sense in static context
super.method();
//^^^^^ Cannot call super method because we're not in an instance method ("super" is unknown in this context)
//^^^^^ Cannot call super method because we're not in an instance
}
}

// super doesn't make sense in global context
super.do();
//^^ Cannot call super method because we're not in an instance method ("super" is unknown in this context)
//^^ Cannot call super method because we're not in an instance


// Verify correct error message when inflight closure tries to access super (this isn't suported yet see: https://github.com/winglang/wing/issues/3474)
Expand Down
4 changes: 1 addition & 3 deletions libs/wingc/src/type_check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4304,9 +4304,7 @@ pub fn resolve_super_method(method: &Symbol, env: &SymbolEnv, types: &Types) ->
}
} else {
Err(TypeError {
message:
"Cannot call super method because we're not in an instance method (\"super\" is unknown in this context)"
.to_string(),
message: "Cannot call super method because we're not in an instance".to_string(),
span: method.span.clone(),
})
}
Expand Down

0 comments on commit 2779a94

Please sign in to comment.