Skip to content

Keywords are not escaped in compiler #3544

@andrzejressel

Description

@andrzejressel

Search before asking

  • I had searched in the issues and found no similar issues.

Version

"0.16.0"

Component(s)

Rust

Minimal reproduce step

test.fdl

package my_package;

enum Type {
    BOOL = 0;
}

message MyMessage {
    Type type = 1;
}

foryc --lang rust --rust_out .\src\ .\pcl.fdl

What did you expect to see?

Code should compile

What did you see instead?

error: expected identifier, found keyword `type`                                                                                                                                                                                                                                                                   
  --> src\my_package.rs:34:9
   |
32 | pub struct MyMessage {
   |            --------- while parsing this struct
33 |     #[fory(id = 1)]
34 |     pub type: Type,
   |         ^^^^ expected identifier, found keyword
   |
help: escape `type` to use it as an identifier
   |
34 |     pub r#type: Type,
   |         ++

Anything Else?

No response

Are you willing to submit a PR?

  • I'm willing to submit a PR!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions