登录
注册
开源
企业版
高校版
搜索
帮助中心
使用条款
关于我们
开源
企业版
高校版
私有云
模力方舟
AI 队友
登录
注册
代码拉取完成,页面将自动刷新
仓库状态说明
开源项目
>
OpenHarmony
>
OpenHarmony工具集
&&
捐赠
捐赠前请先登录
取消
前往登录
扫描微信二维码支付
取消
支付完成
支付提示
将跳转至支付宝完成支付
确定
取消
Watch
不关注
关注所有动态
仅关注版本发行动态
关注但不提醒动态
49
Star
129
Fork
1.1K
OpenHarmony
/
arkcompiler_ets_frontend
关闭
代码
Issues
401
Pull Requests
338
Wiki
统计
流水线
服务
JavaDoc
PHPDoc
质量分析
Jenkins for Gitee
腾讯云托管
腾讯云 Serverless
悬镜安全
阿里云 SAE
Codeblitz
SBOM
开发画像分析
我知道了,不再自动展开
更新失败,请稍后重试!
移除标识
内容风险标识
本任务被
标识为内容中包含有代码安全 Bug 、隐私泄露等敏感信息,仓库外成员不可访问
Diagnostic improvement
已完成
#IBHK5E
Chernykh Sergey
成员
创建于
2025-01-13 21:01
### 新需求提供了什么功能? ### Design of diagnostic collection and reporting #### Diagnostic object 1. Diagnostic kind: - **_CompilerBug_** - for compiler internal errors. All _unreachables_, _asserts_ and _segfaults_ must be wrapped into this kind of diagnostic. Diagnostic message must contain all information about fail(es2panda version, stack trace and maybe something else) and suggestion to report this bug special channel (gitee issue tracker, on email). Action: _abort_. - **_Fatal_** - log and _abort_, when it isn't possible to continue compilation. - **_SyntaxError_** - diagnose grammar violations - **_SemanticError_** - diagnose type system, name resolution and other non-grammar violations - **_Warning_** - notify users about some depricated features and possible bugs - **_PluginError_** - diagnose error from plugins 2. Every diagnostic must contains: - **Loc** - begin and end position of source code, which course a diagnostic message - **DiagType** - kind of diagnostic - **DiagID** - id number of diagnostic message - **DiagParams** - params to format diagnostic message - **Suggestions** - suggestions with code transformation to solve this error. Example for error "Unresolved referense 'xx'". One of the possible suggestion can be "Maybe do you mean 'x'". - **Parser context** - (optional) for syntax errors - **Plugin name** - (optional) for plugins errors #### Diagnostic descriptions All non-plugins diagnostic will describes into `yaml` files with following structure: - `Name` - short name, will be identifier in c++ code - `Id` - unique number of diagnostic message - `Message` - format string of diagnostic message - `Suggestions` - _(optional)_ format strings for possible suggestions] All diagnostic messages must be correct, short and clear. We need rule for diagnostic messages like [Swift](https://github.com/swiftlang/swift/blob/main/docs/Diagnostics.md#grammar-and-phrasing). Also locals must be supported. #### Diagnostic collection and emition 1. All non-abort diagnostic will be saved into separate vectors. One vector for each kind of diagnostic. 2. Emit diagnostic points: - After checker and abort if there are some error. All warnings or some specific warnings can be like non-abort errors if special option is passed - Before abort of `Fatal` and `CompilerBug` diagnostic - Emit warnings in the end of pipeline if there aren't any errors 3. Before emition: 1. All vectors will merged 2. Resulted vector will be sorted by diagnostic location 3. Dublicated diagnotic will be removed 4. There must be several options for diagnostic emition: - Short, IDE friendly - 1 line message, like now - More verbose and beautifull for CLI. With source line highlighting and suggestions #### Recovery and diagnistic Need to implement several methods for correct and exact problem diagnostic and recovery after errors. For example: - Check missing keyword, type and etc - Check missing closing brace - ... - Use transactions to check something and rollback parser state, can be usefull for detection TS-specific code - Reparse some part of code, if there are some specific errors, can be usefull for detection TS-specific code #### Error message format 1. Short, IDE fiendly: ``` [path_from_project_root/file.sts:line:offset] Category (ERROR_ID): Error message ``` * Category - Syntax error | Semantic error | Warning | {Plugin name} plugin error | Compiler bug | Suggestion * ERROR_ID - prefix + id, * ERROR_ID: - Syntax error: S0001 - S0999 - Semantic error: E1001 - E1999 - Warning: W2001 - W2999 - Plugin error: PLUGIN_NAME P9000+unique id for plugin (for example: P9001, P9002, P9003), one ID can be generated for different plugins, difference will be in plugin name Example: ``` [src/main.sts:13:3] Syntax error S0001: Unexpected token '}' in the end of function 'Foo'. '}' expected [src/main.sts:13:3] Suggestion: Replace with '}' [src/plugin/foo.sts:1:11] Semantic error E1003: 'string' can't be converted to 'number' [src/test.sts:15:1] Memo plugin error P0001: Memoization supported only for class methods [src/test.sts:20:15] Compiler bug: tvoi kod - plohoi. Ia obidelsia =( ``` 2. CLI messages example. Format and colors will be specified later. ``` > [src/main.sts:13:3] Syntax error S0001 Unexpected token '}' in the end of function 'Foo'. '}' expected | return 42 (note: light grey for more context) 13 | { | ^ Replace with '}' ``` Something like this with colors:  ### 该需求带来的价值、应用场景? .
### 新需求提供了什么功能? ### Design of diagnostic collection and reporting #### Diagnostic object 1. Diagnostic kind: - **_CompilerBug_** - for compiler internal errors. All _unreachables_, _asserts_ and _segfaults_ must be wrapped into this kind of diagnostic. Diagnostic message must contain all information about fail(es2panda version, stack trace and maybe something else) and suggestion to report this bug special channel (gitee issue tracker, on email). Action: _abort_. - **_Fatal_** - log and _abort_, when it isn't possible to continue compilation. - **_SyntaxError_** - diagnose grammar violations - **_SemanticError_** - diagnose type system, name resolution and other non-grammar violations - **_Warning_** - notify users about some depricated features and possible bugs - **_PluginError_** - diagnose error from plugins 2. Every diagnostic must contains: - **Loc** - begin and end position of source code, which course a diagnostic message - **DiagType** - kind of diagnostic - **DiagID** - id number of diagnostic message - **DiagParams** - params to format diagnostic message - **Suggestions** - suggestions with code transformation to solve this error. Example for error "Unresolved referense 'xx'". One of the possible suggestion can be "Maybe do you mean 'x'". - **Parser context** - (optional) for syntax errors - **Plugin name** - (optional) for plugins errors #### Diagnostic descriptions All non-plugins diagnostic will describes into `yaml` files with following structure: - `Name` - short name, will be identifier in c++ code - `Id` - unique number of diagnostic message - `Message` - format string of diagnostic message - `Suggestions` - _(optional)_ format strings for possible suggestions] All diagnostic messages must be correct, short and clear. We need rule for diagnostic messages like [Swift](https://github.com/swiftlang/swift/blob/main/docs/Diagnostics.md#grammar-and-phrasing). Also locals must be supported. #### Diagnostic collection and emition 1. All non-abort diagnostic will be saved into separate vectors. One vector for each kind of diagnostic. 2. Emit diagnostic points: - After checker and abort if there are some error. All warnings or some specific warnings can be like non-abort errors if special option is passed - Before abort of `Fatal` and `CompilerBug` diagnostic - Emit warnings in the end of pipeline if there aren't any errors 3. Before emition: 1. All vectors will merged 2. Resulted vector will be sorted by diagnostic location 3. Dublicated diagnotic will be removed 4. There must be several options for diagnostic emition: - Short, IDE friendly - 1 line message, like now - More verbose and beautifull for CLI. With source line highlighting and suggestions #### Recovery and diagnistic Need to implement several methods for correct and exact problem diagnostic and recovery after errors. For example: - Check missing keyword, type and etc - Check missing closing brace - ... - Use transactions to check something and rollback parser state, can be usefull for detection TS-specific code - Reparse some part of code, if there are some specific errors, can be usefull for detection TS-specific code #### Error message format 1. Short, IDE fiendly: ``` [path_from_project_root/file.sts:line:offset] Category (ERROR_ID): Error message ``` * Category - Syntax error | Semantic error | Warning | {Plugin name} plugin error | Compiler bug | Suggestion * ERROR_ID - prefix + id, * ERROR_ID: - Syntax error: S0001 - S0999 - Semantic error: E1001 - E1999 - Warning: W2001 - W2999 - Plugin error: PLUGIN_NAME P9000+unique id for plugin (for example: P9001, P9002, P9003), one ID can be generated for different plugins, difference will be in plugin name Example: ``` [src/main.sts:13:3] Syntax error S0001: Unexpected token '}' in the end of function 'Foo'. '}' expected [src/main.sts:13:3] Suggestion: Replace with '}' [src/plugin/foo.sts:1:11] Semantic error E1003: 'string' can't be converted to 'number' [src/test.sts:15:1] Memo plugin error P0001: Memoization supported only for class methods [src/test.sts:20:15] Compiler bug: tvoi kod - plohoi. Ia obidelsia =( ``` 2. CLI messages example. Format and colors will be specified later. ``` > [src/main.sts:13:3] Syntax error S0001 Unexpected token '}' in the end of function 'Foo'. '}' expected | return 42 (note: light grey for more context) 13 | { | ^ Replace with '}' ``` Something like this with colors:  ### 该需求带来的价值、应用场景? .
评论 (
2
)
登录
后才可以发表评论
状态
已完成
待办的
进行中
已完成
已拒绝
负责人
未设置
标签
enhancement
waiting_for_assign
异常关闭
未设置
项目
未立项任务
未立项任务
里程碑
未关联里程碑
未关联里程碑
Pull Requests
未关联
未关联
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
未关联
分支 (
-
)
标签 (
-
)
开始日期   -   截止日期
-
置顶选项
不置顶
置顶等级:高
置顶等级:中
置顶等级:低
优先级
不指定
严重
主要
次要
不重要
预计工期
(小时)
参与者(2)
1
https://gitee.com/openharmony/arkcompiler_ets_frontend.git
git@gitee.com:openharmony/arkcompiler_ets_frontend.git
openharmony
arkcompiler_ets_frontend
arkcompiler_ets_frontend
点此查找更多帮助
搜索帮助
Git 命令在线学习
如何在 Gitee 导入 GitHub 仓库
Git 仓库基础操作
企业版和社区版功能对比
SSH 公钥设置
如何处理代码冲突
仓库体积过大,如何减小?
如何找回被删除的仓库数据
Gitee 产品配额说明
GitHub仓库快速导入Gitee及同步更新
什么是 Release(发行版)
将 PHP 项目自动发布到 packagist.org
评论
仓库举报
回到顶部
登录提示
该操作需登录 Gitee 帐号,请先登录后再操作。
立即登录
没有帐号,去注册