-
Notifications
You must be signed in to change notification settings - Fork 115
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
[WIP] Feat(CompilerBase-Error): Add 'One-Sentence', text rendering and error handler to CompilerError. #136
Conversation
Pull Request Test Coverage Report for Build 2817522474
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pls merge your 17 commits+
Delete KCL related content in CompilerBase, considering generality |
@@ -0,0 +1,108 @@ | |||
//! 'Style' is responsible for providing 'Shader' for text color rendering. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest this package is available as a 3rdparty for compiler_base
/// | ||
/// e.g. an error diagnostic. | ||
/// error[E0999]: oh no! this is an error! | ||
/// --> mycode.k:3:5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove the *.k
/// Sentence 1: error[E0999]: oh no! this is an error! | ||
/// | ||
/// Sentence 2: | ||
/// --> mycode.rs:3:5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove the *.rs
|
||
// before | ||
// | ||
// KCL Complier Error[E2L28] : Unique key error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove KCL
/// error: this is an error! | ||
/// warning[W0011]: this is an warning! | ||
/// note: this is note. | ||
/// KCL error[E1000]: this is a KCL error! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove KCL
/// A Position is valid if the line number is > 0. | ||
/// The line and column are both 1 based. | ||
#[derive(PartialEq, Clone, Eq, Hash, Debug, Default)] | ||
pub struct Position { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use Span
and SourceMap
instead of Position to calculate the error Postion
.
@@ -0,0 +1,11 @@ | |||
schema Person: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove KCL tests.
@@ -0,0 +1,14 @@ | |||
[package] | |||
name = "compiler-base-diagnostic" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should compiler-base-diagnostic
belongs to compiler-base-error
?
@@ -52,5 +52,8 @@ members = [ | |||
"sema", | |||
"span", | |||
"tools", | |||
"version" | |||
"version", | |||
"compiler_base", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
compiler_base is not one of kclvm members.
use std::panic; | ||
use compiler_base_diagnostic::{emitter::{Emitter, EmitterWriter}, DiagnosticBuilder}; | ||
|
||
pub struct ErrHandler { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How can I use ErrHandler
? and it should be part of the error package?
Important things:
|
"version" | ||
"version", | ||
"compiler_base", | ||
"compiler_base/error", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/error/errors/
Split large WIP PRs into smaller ones |
1. Does this PR affect any open issues?(Y/N) and add issue references (e.g. "fix #123", "re #123".):
fix #115
2. What is the scope of this PR (e.g. component or file name):
kclvm/compiler_base
3. Provide a description of the PR(e.g. more details, effects, motivations or doc link):
4. Are there any breaking changes?(Y/N) and describe the breaking changes(e.g. more details, motivations or doc link):
5. Are there test cases for these changes?(Y/N) select and add more details, references or doc links:
The unit test cases in
/kclvm/compiler_base/diagnostic/src/tests.rs
/kclvm/compiler_base/style/src/tests.rs
6. Release note
Please refer to Release Notes Language Style Guide to write a quality release note.