Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: dict upgrade schema type and check #1531

Merged
merged 1 commit into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions kclvm/error/src/diagnostic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,12 @@ impl Diagnostic {

pub type Range = (Position, Position);

/// Returns a dummy range whose filename is empty, line is 1 and column is None.
#[inline]
pub fn dummy_range() -> Range {
(Position::dummy_pos(), Position::dummy_pos())
}

#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct Message {
pub range: Range,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,18 @@ expression: "format!(\"{:#?}\", p.symbols.values())"
flags: STR,
},
has_default: false,
range: (
Position {
filename: "",
line: 1,
column: None,
},
Position {
filename: "",
line: 1,
column: None,
},
),
},
Parameter {
name: "type",
Expand All @@ -70,6 +82,18 @@ expression: "format!(\"{:#?}\", p.symbols.values())"
flags: STR,
},
has_default: true,
range: (
Position {
filename: "",
line: 1,
column: None,
},
Position {
filename: "",
line: 1,
column: None,
},
),
},
Parameter {
name: "required",
Expand All @@ -79,6 +103,18 @@ expression: "format!(\"{:#?}\", p.symbols.values())"
flags: BOOL,
},
has_default: true,
range: (
Position {
filename: "",
line: 1,
column: None,
},
Position {
filename: "",
line: 1,
column: None,
},
),
},
Parameter {
name: "default",
Expand All @@ -88,6 +124,18 @@ expression: "format!(\"{:#?}\", p.symbols.values())"
flags: ANY,
},
has_default: true,
range: (
Position {
filename: "",
line: 1,
column: None,
},
Position {
filename: "",
line: 1,
column: None,
},
),
},
Parameter {
name: "help",
Expand All @@ -97,6 +145,18 @@ expression: "format!(\"{:#?}\", p.symbols.values())"
flags: STR,
},
has_default: true,
range: (
Position {
filename: "",
line: 1,
column: None,
},
Position {
filename: "",
line: 1,
column: None,
},
),
},
],
self_ty: None,
Expand Down
180 changes: 180 additions & 0 deletions kclvm/loader/src/snapshots/kclvm_loader__tests__builtin_call_2.snap
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,18 @@ expression: "format!(\"{:#?}\", p.symbols.values())"
flags: STR,
},
has_default: false,
range: (
Position {
filename: "",
line: 1,
column: None,
},
Position {
filename: "",
line: 1,
column: None,
},
),
},
Parameter {
name: "type",
Expand All @@ -26,6 +38,18 @@ expression: "format!(\"{:#?}\", p.symbols.values())"
flags: STR,
},
has_default: true,
range: (
Position {
filename: "",
line: 1,
column: None,
},
Position {
filename: "",
line: 1,
column: None,
},
),
},
Parameter {
name: "required",
Expand All @@ -35,6 +59,18 @@ expression: "format!(\"{:#?}\", p.symbols.values())"
flags: BOOL,
},
has_default: true,
range: (
Position {
filename: "",
line: 1,
column: None,
},
Position {
filename: "",
line: 1,
column: None,
},
),
},
Parameter {
name: "default",
Expand All @@ -44,6 +80,18 @@ expression: "format!(\"{:#?}\", p.symbols.values())"
flags: ANY,
},
has_default: true,
range: (
Position {
filename: "",
line: 1,
column: None,
},
Position {
filename: "",
line: 1,
column: None,
},
),
},
Parameter {
name: "help",
Expand All @@ -53,6 +101,18 @@ expression: "format!(\"{:#?}\", p.symbols.values())"
flags: STR,
},
has_default: true,
range: (
Position {
filename: "",
line: 1,
column: None,
},
Position {
filename: "",
line: 1,
column: None,
},
),
},
],
self_ty: None,
Expand Down Expand Up @@ -122,6 +182,18 @@ expression: "format!(\"{:#?}\", p.symbols.values())"
flags: STR,
},
has_default: false,
range: (
Position {
filename: "",
line: 1,
column: None,
},
Position {
filename: "",
line: 1,
column: None,
},
),
},
Parameter {
name: "type",
Expand All @@ -131,6 +203,18 @@ expression: "format!(\"{:#?}\", p.symbols.values())"
flags: STR,
},
has_default: true,
range: (
Position {
filename: "",
line: 1,
column: None,
},
Position {
filename: "",
line: 1,
column: None,
},
),
},
Parameter {
name: "required",
Expand All @@ -140,6 +224,18 @@ expression: "format!(\"{:#?}\", p.symbols.values())"
flags: BOOL,
},
has_default: true,
range: (
Position {
filename: "",
line: 1,
column: None,
},
Position {
filename: "",
line: 1,
column: None,
},
),
},
Parameter {
name: "default",
Expand All @@ -149,6 +245,18 @@ expression: "format!(\"{:#?}\", p.symbols.values())"
flags: ANY,
},
has_default: true,
range: (
Position {
filename: "",
line: 1,
column: None,
},
Position {
filename: "",
line: 1,
column: None,
},
),
},
Parameter {
name: "help",
Expand All @@ -158,6 +266,18 @@ expression: "format!(\"{:#?}\", p.symbols.values())"
flags: STR,
},
has_default: true,
range: (
Position {
filename: "",
line: 1,
column: None,
},
Position {
filename: "",
line: 1,
column: None,
},
),
},
],
self_ty: None,
Expand Down Expand Up @@ -263,6 +383,18 @@ expression: "format!(\"{:#?}\", p.symbols.values())"
flags: STR,
},
has_default: false,
range: (
Position {
filename: "",
line: 1,
column: None,
},
Position {
filename: "",
line: 1,
column: None,
},
),
},
Parameter {
name: "type",
Expand All @@ -272,6 +404,18 @@ expression: "format!(\"{:#?}\", p.symbols.values())"
flags: STR,
},
has_default: true,
range: (
Position {
filename: "",
line: 1,
column: None,
},
Position {
filename: "",
line: 1,
column: None,
},
),
},
Parameter {
name: "required",
Expand All @@ -281,6 +425,18 @@ expression: "format!(\"{:#?}\", p.symbols.values())"
flags: BOOL,
},
has_default: true,
range: (
Position {
filename: "",
line: 1,
column: None,
},
Position {
filename: "",
line: 1,
column: None,
},
),
},
Parameter {
name: "default",
Expand All @@ -290,6 +446,18 @@ expression: "format!(\"{:#?}\", p.symbols.values())"
flags: ANY,
},
has_default: true,
range: (
Position {
filename: "",
line: 1,
column: None,
},
Position {
filename: "",
line: 1,
column: None,
},
),
},
Parameter {
name: "help",
Expand All @@ -299,6 +467,18 @@ expression: "format!(\"{:#?}\", p.symbols.values())"
flags: STR,
},
has_default: true,
range: (
Position {
filename: "",
line: 1,
column: None,
},
Position {
filename: "",
line: 1,
column: None,
},
),
},
],
self_ty: None,
Expand Down
Loading
Loading