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

为 gccgo.po 的 31 到 115 行构造范例,除了70和74行。 #6

Merged
merged 16 commits into from
Dec 24, 2014
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
5 changes: 5 additions & 0 deletions tests/argument_1_must_be_a_map.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
//po:MsgId "argument 1 must be a map"
//po:MsgStr "实参必须是常数"

package p

func F() {
delete(1, 2)
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
//po:MsgId "argument of Offsetof implies indirection of an embedded field"
//po:MsgStr ""

package p

import "unsafe"

type T1 struct {
X int
}

type T struct {
*T1
}

var x = unsafe.Offsetof(T{}.X)
3 changes: 3 additions & 0 deletions tests/expected_integer_or_boolean_type.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//po:MsgId "expected integer or boolean type"
//po:MsgStr "需要整数或布尔类型"

package p

var x = ^3.14
3 changes: 3 additions & 0 deletions tests/expected_pointer.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//po:MsgId "expected pointer"
//po:MsgStr "需要指针"

package p

var x = *nil
3 changes: 3 additions & 0 deletions tests/incompatible_types_in_binary_expression.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//po:MsgId "incompatible types in binary expression"
//po:MsgStr "二元表达式中类型不匹配"

package p

var x = "1" + 1
4 changes: 4 additions & 0 deletions tests/integer_division_by_zero.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
//po:MsgId "integer division by zero"
//po:MsgStr "被零除"

package p

var x = 1
var y = x / 0
3 changes: 3 additions & 0 deletions tests/invalid_comparison_of_nil_with_nil.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//po:MsgId "invalid comparison of nil with nil"
//po:MsgStr "gimple 条件中比较代码无效"

package p

var x = nil == nil
3 changes: 3 additions & 0 deletions tests/invalid_type_for_make_function.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//po:MsgId "invalid type for make function"
//po:MsgStr "函数%q+#D的抽象返回类型无效"

package p

var x = make(int)
9 changes: 9 additions & 0 deletions tests/invalid_use_of_method_value_as_argument_of_Offsetof.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
//po:MsgId "invalid use of method value as argument of Offsetof"
//po:MsgStr "使用模板名%qE时不带实参表无效"

package p

import "unsafe"

type T struct{}

func (T) F() {}

var x = unsafe.Offsetof(T{}.F)
6 changes: 6 additions & 0 deletions tests/invalid_use_of_with_builtin_function.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
//po:MsgId "invalid use of %<...%> with builtin function"
//po:MsgStr "内建函数实参无效"

package p

func F() {
chans := []chan bool{}
close(chans...)
}
3 changes: 3 additions & 0 deletions tests/len_larger_than_cap.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//po:MsgId "len larger than cap"
//po:MsgStr ""

package p

var x = make([]byte, 10, 1)
4 changes: 4 additions & 0 deletions tests/negative_shift_count.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
//po:MsgId "negative shift count"
//po:MsgStr "移位次数为负"

package p

var x = 1
var y = x >> -1
5 changes: 5 additions & 0 deletions tests/not_enough_arguments.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
//po:MsgId "not enough arguments"
//po:MsgStr "实参太少"

package p

func F(int, int, int) int

var x = F(1, 2)
4 changes: 4 additions & 0 deletions tests/shift_count_not_unsigned_integer.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
//po:MsgId "shift count not unsigned integer"
//po:MsgStr "switch 语句中的值不是一个整数"

package p

var x = 1
var y = 1 >> x
4 changes: 4 additions & 0 deletions tests/shift_of_non_integer_operand.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
//po:MsgId "shift of non-integer operand"
//po:MsgStr "非整数操作数使用了操作数代码‘%c’"

package p

var x float32
var y = x << 2
5 changes: 5 additions & 0 deletions tests/too_many_arguments.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
//po:MsgId "too many arguments"
//po:MsgStr "实参太多"

package p

func F() int

var x = F(1)