Skip to content

Commit

Permalink
Fixes OOB in type_check_analyze of ImplTrait.
Browse files Browse the repository at this point in the history
An unused line of code was throwing an OOB panic because of parser error.
Removing the unused line of code fixes the issue.

Fixes #6331
  • Loading branch information
esdrubal committed Sep 16, 2024
1 parent ba153b2 commit ca835f3
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1629,8 +1629,7 @@ impl TypeCheckAnalysis for ty::ImplSelfOrTrait {
ctx.push_nodes_for_impl_trait(self);

// Now lets analyze each impl trait item.
for (i, item) in impl_trait.items.iter().enumerate() {
let _node = ctx.items_node_stack[i];
for item in impl_trait.items.iter() {
item.type_check_analyze(handler, ctx)?;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[[package]]
name = "core"
source = "path+from-root-F62FA9D54ABC8F01"

[[package]]
name = "mismatch_closing_delimiters"
source = "member"
dependencies = ["core"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[project]
authors = ["Fuel Labs <[email protected]>"]
license = "Apache-2.0"
name = "mismatch_closing_delimiters"
entry = "main.sw"
implicit-std = false

[dependencies]
core = { path = "../../../../../../sway-lib-core" }
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
script;

struct Struct{x:u}
impl Struct{
fn w()->f{{(()}}
trait Supertrait{}
impl Supertrait for Struct{)
}

fn s<A>(b:B) where A:t{}fn n(){}

fn main() -> u64 {
0
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
category = "fail"

# check: $()fn w()->f{{(()}}
# nextln: $()mismatched delimiters

0 comments on commit ca835f3

Please sign in to comment.