FuelLabs / FuelLabs/sway

Fix remaining issues in raw identifiers

Open
#7,136 3 comments 0 reactions 0 assignees View on GitHub
bug compiler compiler: frontend compiler: parser team:compiler
Dominant language
Rust
Stars
61.4k
Forks
5.4k
Avg merge
3h 33m
Merged PRs (30d)
4

Description

The `should_pass/language/raw_identifiers` test extended in #7137 pointed out several issues in the handling of raw identifiers. To reproduce them, uncomment the code marked as TODO linking to this issue. Below is the summary.

If there is a raw ident variable with the same name as a row ident function, the function call fails with the error that the declaration is not a function but a variable:
```sway
let v = r#fn(r#fn);
```

Struct instantiation of a raw-ident named struct cannot find the struct:
```sway
let v = r#struct {
r#u64: 42,
};
```

Enum instantiation of a raw-ident named enum cannot find the enum:
```sway
r#enum::r#bool(false)
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the should_pass/language/raw_identifiers test and uncomment the TODO cases linked to this issue. Run the test to reproduce the function-call, struct-instantiation, and enum-instantiation failures, then trace the compiler's raw-identifier handling. Done means all listed examples compile or resolve correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.