Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wa-lang
wa
提交
6b88c184
wa
项目概览
wa-lang
/
wa
10 个月 前同步成功
通知
68
Star
655
Fork
45
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
wa
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
6b88c184
编写于
6月 09, 2023
作者:
chai2010
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
补充类型断言失败的例子
上级
c13d6105
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
34 addition
and
3 deletion
+34
-3
_examples/copy.wa
_examples/copy.wa
+1
-1
_examples/interface_named.wa
_examples/interface_named.wa
+1
-1
_examples/strbytes.wa
_examples/strbytes.wa
+2
-0
_examples/struct.wa
_examples/struct.wa
+1
-1
_tests/Makefile
_tests/Makefile
+7
-0
_tests/readme.md
_tests/readme.md
+1
-0
_tests/type-assert-01.wa
_tests/type-assert-01.wa
+21
-0
未找到文件。
_examples/copy.wa
浏览文件 @
6b88c184
#
版权 @2021 凹语言 作者。保留所有权利。
//
版权 @2021 凹语言 作者。保留所有权利。
var s = []int{1, 2, 3, 4, 5, 6}
func main() {
...
...
_examples/interface_named.wa
浏览文件 @
6b88c184
#
版权 @2021 凹语言 作者。保留所有权利。
//
版权 @2021 凹语言 作者。保留所有权利。
type T1 struct {
a: i32
...
...
_examples/strbytes.wa
浏览文件 @
6b88c184
// 版权 @2023 凹语言 作者。保留所有权利。
func main() {
println("a:", 42)
str := "hello"
...
...
_examples/struct.wa
浏览文件 @
6b88c184
// 版权 @202
1
凹语言 作者。保留所有权利。
// 版权 @202
3
凹语言 作者。保留所有权利。
var Info: struct{
name: string
...
...
_tests/Makefile
0 → 100644
浏览文件 @
6b88c184
run
:
go run ../main.go type-assert-01.wa
ssa
:
go run ../main.go ssa type-assert-01.wa
clean
:
_tests/readme.md
0 → 100644
浏览文件 @
6b88c184
# 凹语言自身测试(语言开发者使用)
\ No newline at end of file
_tests/type-assert-01.wa
0 → 100644
浏览文件 @
6b88c184
// 版权 @2023 凹语言 作者。保留所有权利。
func main {
var err: myIface = &errorString{"myError"}
xerr, ok := err.(myIface)
println("ok:", ok) // BUG: OK 始终返回 false
println("xerr:", xerr)
}
type myIface interface {
MyError() => string
}
type errorString struct {
s: string
}
func errorString.MyError => string {
return this.s
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录