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

More errors #90

Open
wants to merge 20 commits into
base: rewrite
Choose a base branch
from
Open

More errors #90

wants to merge 20 commits into from

Conversation

nezuo
Copy link
Contributor

@nezuo nezuo commented Jun 11, 2024

No description provided.

@nezuo nezuo marked this pull request as draft June 11, 2024 05:16
zapc/src/meta/report.rs Outdated Show resolved Hide resolved
zapc/src/meta/report.rs Outdated Show resolved Hide resolved
zapc/src/meta/report.rs Outdated Show resolved Hide resolved
zapc/src/hir_builder/decl.rs Outdated Show resolved Hide resolved
@nezuo nezuo marked this pull request as ready for review July 6, 2024 21:19
Comment on lines 207 to 234
if word == "server" || word == "client" {
self.report(Report::ExpectedValueWrongType {
value_span: words.first().unwrap().span().merge(words.last().unwrap().span()),
expected_values: "\"client\" or \"server\"".to_string(),
found_type: "path".to_string(),
help: Some("add quotes to turn the path into a string".to_string()),
});

return HirEventSource::Server;
} else if word == "Server" || word == "client" {
self.report(Report::ExpectedValueWrongType {
value_span: words.first().unwrap().span().merge(words.last().unwrap().span()),
expected_values: "\"client\" or \"server\"".to_string(),
found_type: "path".to_string(),
help: Some("lowercase the word and add quotes to turn the path into a string".to_string()),
});

return HirEventSource::Server;
}
} else {
// todo: report error
}

self.report(Report::ExpectedValueWrongType {
value_span: words.first().unwrap().span().merge(words.last().unwrap().span()),
expected_values: "\"client\" or \"server\"".to_string(),
found_type: "path".to_string(),
help: None,
});

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we will almost certainly not reuse ExpectedValueWrongType, so I think it would be a better idea to create a more specific report variant for this case.

if generics.len() > 1 {
// todo: report extra generics
self.report(Report::IncorrectGenericCount {
type_span: segment.span(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this wouldn't be the span of the entire type
imagine the type buffer<a, b> - this would only be the span for buffer when you really want it to be the span for the whole type

zapc/src/meta/report.rs Show resolved Hide resolved
@nezuo
Copy link
Contributor Author

nezuo commented Jul 11, 2024

CI was failing because of Rustfmt. It wasn't a file I touched but I formatted it anyways.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants