Merge pull request #2716 from nspcc-dev/test
compiler: take into account inlined types info on `append` builtin handling
This commit is contained in:
commit
b2b5303d06
30 changed files with 74 additions and 48 deletions
|
@ -2,4 +2,4 @@ module github.com/nspcc-dev/neo-go/examples/engine
|
|||
|
||||
go 1.17
|
||||
|
||||
require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220921145301-29564bdda2e9
|
||||
require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220927123257-24c107e3a262
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220921145301-29564bdda2e9 h1:IGfqrLp2BR1jMpOL+uFzPRO5PrUPD5vCdkC42atMMFI=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220921145301-29564bdda2e9/go.mod h1:23bBw0v6pBYcrWs8CBEEDIEDJNbcFoIh8pGGcf2Vv8s=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220927123257-24c107e3a262 h1:UTmSLZw5OpD/JPE1B5Vf98GF0zu2/Hsqq1lGLtStTUE=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220927123257-24c107e3a262/go.mod h1:23bBw0v6pBYcrWs8CBEEDIEDJNbcFoIh8pGGcf2Vv8s=
|
||||
|
|
|
@ -2,4 +2,4 @@ module github.com/nspcc-dev/neo-go/examples/events
|
|||
|
||||
go 1.17
|
||||
|
||||
require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220921145301-29564bdda2e9
|
||||
require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220927123257-24c107e3a262
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220921145301-29564bdda2e9 h1:IGfqrLp2BR1jMpOL+uFzPRO5PrUPD5vCdkC42atMMFI=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220921145301-29564bdda2e9/go.mod h1:23bBw0v6pBYcrWs8CBEEDIEDJNbcFoIh8pGGcf2Vv8s=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220927123257-24c107e3a262 h1:UTmSLZw5OpD/JPE1B5Vf98GF0zu2/Hsqq1lGLtStTUE=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220927123257-24c107e3a262/go.mod h1:23bBw0v6pBYcrWs8CBEEDIEDJNbcFoIh8pGGcf2Vv8s=
|
||||
|
|
|
@ -2,4 +2,4 @@ module github.com/nspcc-dev/neo-go/examples/iterator
|
|||
|
||||
go 1.17
|
||||
|
||||
require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220921145301-29564bdda2e9
|
||||
require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220927123257-24c107e3a262
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220921145301-29564bdda2e9 h1:IGfqrLp2BR1jMpOL+uFzPRO5PrUPD5vCdkC42atMMFI=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220921145301-29564bdda2e9/go.mod h1:23bBw0v6pBYcrWs8CBEEDIEDJNbcFoIh8pGGcf2Vv8s=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220927123257-24c107e3a262 h1:UTmSLZw5OpD/JPE1B5Vf98GF0zu2/Hsqq1lGLtStTUE=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220927123257-24c107e3a262/go.mod h1:23bBw0v6pBYcrWs8CBEEDIEDJNbcFoIh8pGGcf2Vv8s=
|
||||
|
|
|
@ -2,4 +2,4 @@ module github.com/nspcc-dev/neo-go/examples/nft
|
|||
|
||||
go 1.17
|
||||
|
||||
require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220921145301-29564bdda2e9
|
||||
require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220927123257-24c107e3a262
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220921145301-29564bdda2e9 h1:IGfqrLp2BR1jMpOL+uFzPRO5PrUPD5vCdkC42atMMFI=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220921145301-29564bdda2e9/go.mod h1:23bBw0v6pBYcrWs8CBEEDIEDJNbcFoIh8pGGcf2Vv8s=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220927123257-24c107e3a262 h1:UTmSLZw5OpD/JPE1B5Vf98GF0zu2/Hsqq1lGLtStTUE=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220927123257-24c107e3a262/go.mod h1:23bBw0v6pBYcrWs8CBEEDIEDJNbcFoIh8pGGcf2Vv8s=
|
||||
|
|
|
@ -3,8 +3,8 @@ module github.com/nspcc-dev/neo-go/examples/nft-nd-nns
|
|||
go 1.17
|
||||
|
||||
require (
|
||||
github.com/nspcc-dev/neo-go v0.99.4-0.20220923055855-ae511447f9d4
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220921145301-29564bdda2e9
|
||||
github.com/nspcc-dev/neo-go v0.99.4-0.20220927123420-08e251167661
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220927123257-24c107e3a262
|
||||
github.com/stretchr/testify v1.7.0
|
||||
)
|
||||
|
||||
|
|
|
@ -198,12 +198,10 @@ github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRW
|
|||
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
|
||||
github.com/nspcc-dev/go-ordered-json v0.0.0-20220111165707-25110be27d22 h1:n4ZaFCKt1pQJd7PXoMJabZWK9ejjbLOVrkl/lOUmshg=
|
||||
github.com/nspcc-dev/go-ordered-json v0.0.0-20220111165707-25110be27d22/go.mod h1:79bEUDEviBHJMFV6Iq6in57FEOCMcRhfQnfaf0ETA5U=
|
||||
github.com/nspcc-dev/neo-go v0.99.4-0.20220921144034-25667914faf5 h1:Ws7+4nbejBl6tpknmAOtaHQDY0DSmtkdjhsTHnbfosY=
|
||||
github.com/nspcc-dev/neo-go v0.99.4-0.20220921144034-25667914faf5/go.mod h1:NraCCLE6Ky5F3zjuAiv45gaN08AZtDvs41cYofXTibA=
|
||||
github.com/nspcc-dev/neo-go v0.99.4-0.20220923055855-ae511447f9d4 h1:ATYpJWLn+eoUKLJDIo1oKvcbirLVF+QNm3r3HnaRCwc=
|
||||
github.com/nspcc-dev/neo-go v0.99.4-0.20220923055855-ae511447f9d4/go.mod h1:/Uzv7wyW4840Iv/v5bt7gOqsJnL3NmpJZwFuNG/qWV0=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220921145301-29564bdda2e9 h1:IGfqrLp2BR1jMpOL+uFzPRO5PrUPD5vCdkC42atMMFI=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220921145301-29564bdda2e9/go.mod h1:23bBw0v6pBYcrWs8CBEEDIEDJNbcFoIh8pGGcf2Vv8s=
|
||||
github.com/nspcc-dev/neo-go v0.99.4-0.20220927123420-08e251167661 h1:0MonpxeHx2pf7n/y/YEILdSbRfebAhylqjYLQX7FerQ=
|
||||
github.com/nspcc-dev/neo-go v0.99.4-0.20220927123420-08e251167661/go.mod h1:mKTolfRUfKjFso5HPvGSQtUZc70n0VKBMs16eGuC5gA=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220927123257-24c107e3a262 h1:UTmSLZw5OpD/JPE1B5Vf98GF0zu2/Hsqq1lGLtStTUE=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220927123257-24c107e3a262/go.mod h1:23bBw0v6pBYcrWs8CBEEDIEDJNbcFoIh8pGGcf2Vv8s=
|
||||
github.com/nspcc-dev/rfc6979 v0.2.0 h1:3e1WNxrN60/6N0DW7+UYisLeZJyfqZTNOjeV/toYvOE=
|
||||
github.com/nspcc-dev/rfc6979 v0.2.0/go.mod h1:exhIh1PdpDC5vQmyEsGvc4YDM/lyQp/452QxGq/UEso=
|
||||
github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78=
|
||||
|
|
|
@ -2,4 +2,4 @@ module github.com/nspcc-dev/neo-go/examples/nft-nd
|
|||
|
||||
go 1.17
|
||||
|
||||
require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220921145301-29564bdda2e9
|
||||
require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220927123257-24c107e3a262
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220921145301-29564bdda2e9 h1:IGfqrLp2BR1jMpOL+uFzPRO5PrUPD5vCdkC42atMMFI=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220921145301-29564bdda2e9/go.mod h1:23bBw0v6pBYcrWs8CBEEDIEDJNbcFoIh8pGGcf2Vv8s=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220927123257-24c107e3a262 h1:UTmSLZw5OpD/JPE1B5Vf98GF0zu2/Hsqq1lGLtStTUE=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220927123257-24c107e3a262/go.mod h1:23bBw0v6pBYcrWs8CBEEDIEDJNbcFoIh8pGGcf2Vv8s=
|
||||
|
|
|
@ -2,4 +2,4 @@ module github.com/nspcc-dev/neo-go/examples/oracle
|
|||
|
||||
go 1.17
|
||||
|
||||
require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220921145301-29564bdda2e9
|
||||
require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220927123257-24c107e3a262
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220921145301-29564bdda2e9 h1:IGfqrLp2BR1jMpOL+uFzPRO5PrUPD5vCdkC42atMMFI=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220921145301-29564bdda2e9/go.mod h1:23bBw0v6pBYcrWs8CBEEDIEDJNbcFoIh8pGGcf2Vv8s=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220927123257-24c107e3a262 h1:UTmSLZw5OpD/JPE1B5Vf98GF0zu2/Hsqq1lGLtStTUE=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220927123257-24c107e3a262/go.mod h1:23bBw0v6pBYcrWs8CBEEDIEDJNbcFoIh8pGGcf2Vv8s=
|
||||
|
|
|
@ -2,4 +2,4 @@ module github.com/nspcc-dev/neo-go/examples/runtime
|
|||
|
||||
go 1.17
|
||||
|
||||
require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220921145301-29564bdda2e9
|
||||
require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220927123257-24c107e3a262
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220921145301-29564bdda2e9 h1:IGfqrLp2BR1jMpOL+uFzPRO5PrUPD5vCdkC42atMMFI=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220921145301-29564bdda2e9/go.mod h1:23bBw0v6pBYcrWs8CBEEDIEDJNbcFoIh8pGGcf2Vv8s=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220927123257-24c107e3a262 h1:UTmSLZw5OpD/JPE1B5Vf98GF0zu2/Hsqq1lGLtStTUE=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220927123257-24c107e3a262/go.mod h1:23bBw0v6pBYcrWs8CBEEDIEDJNbcFoIh8pGGcf2Vv8s=
|
||||
|
|
|
@ -2,4 +2,4 @@ module github.com/nspcc-dev/neo-go/examples/storage
|
|||
|
||||
go 1.17
|
||||
|
||||
require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220921145301-29564bdda2e9
|
||||
require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220927123257-24c107e3a262
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220921145301-29564bdda2e9 h1:IGfqrLp2BR1jMpOL+uFzPRO5PrUPD5vCdkC42atMMFI=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220921145301-29564bdda2e9/go.mod h1:23bBw0v6pBYcrWs8CBEEDIEDJNbcFoIh8pGGcf2Vv8s=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220927123257-24c107e3a262 h1:UTmSLZw5OpD/JPE1B5Vf98GF0zu2/Hsqq1lGLtStTUE=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220927123257-24c107e3a262/go.mod h1:23bBw0v6pBYcrWs8CBEEDIEDJNbcFoIh8pGGcf2Vv8s=
|
||||
|
|
|
@ -2,4 +2,4 @@ module github.com/nspcc-dev/neo-go/examples/timer
|
|||
|
||||
go 1.17
|
||||
|
||||
require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220921145301-29564bdda2e9
|
||||
require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220927123257-24c107e3a262
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220921145301-29564bdda2e9 h1:IGfqrLp2BR1jMpOL+uFzPRO5PrUPD5vCdkC42atMMFI=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220921145301-29564bdda2e9/go.mod h1:23bBw0v6pBYcrWs8CBEEDIEDJNbcFoIh8pGGcf2Vv8s=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220927123257-24c107e3a262 h1:UTmSLZw5OpD/JPE1B5Vf98GF0zu2/Hsqq1lGLtStTUE=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220927123257-24c107e3a262/go.mod h1:23bBw0v6pBYcrWs8CBEEDIEDJNbcFoIh8pGGcf2Vv8s=
|
||||
|
|
|
@ -2,4 +2,4 @@ module github.com/nspcc-dev/neo-go/examples/token
|
|||
|
||||
go 1.17
|
||||
|
||||
require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220921145301-29564bdda2e9
|
||||
require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220927123257-24c107e3a262
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220921145301-29564bdda2e9 h1:IGfqrLp2BR1jMpOL+uFzPRO5PrUPD5vCdkC42atMMFI=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220921145301-29564bdda2e9/go.mod h1:23bBw0v6pBYcrWs8CBEEDIEDJNbcFoIh8pGGcf2Vv8s=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220927123257-24c107e3a262 h1:UTmSLZw5OpD/JPE1B5Vf98GF0zu2/Hsqq1lGLtStTUE=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220927123257-24c107e3a262/go.mod h1:23bBw0v6pBYcrWs8CBEEDIEDJNbcFoIh8pGGcf2Vv8s=
|
||||
|
|
2
go.mod
2
go.mod
|
@ -13,7 +13,7 @@ require (
|
|||
github.com/mr-tron/base58 v1.2.0
|
||||
github.com/nspcc-dev/dbft v0.0.0-20220902113116-58a5e763e647
|
||||
github.com/nspcc-dev/go-ordered-json v0.0.0-20220111165707-25110be27d22
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220921145301-29564bdda2e9
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220927123257-24c107e3a262
|
||||
github.com/nspcc-dev/neofs-sdk-go v0.0.0-20220113123743-7f3162110659
|
||||
github.com/nspcc-dev/rfc6979 v0.2.0
|
||||
github.com/pierrec/lz4 v2.6.1+incompatible
|
||||
|
|
4
go.sum
4
go.sum
|
@ -260,8 +260,8 @@ github.com/nspcc-dev/hrw v1.0.9 h1:17VcAuTtrstmFppBjfRiia4K2wA/ukXZhLFS8Y8rz5Y=
|
|||
github.com/nspcc-dev/hrw v1.0.9/go.mod h1:l/W2vx83vMQo6aStyx2AuZrJ+07lGv2JQGlVkPG06MU=
|
||||
github.com/nspcc-dev/neo-go v0.73.1-pre.0.20200303142215-f5a1b928ce09/go.mod h1:pPYwPZ2ks+uMnlRLUyXOpLieaDQSEaf4NM3zHVbRjmg=
|
||||
github.com/nspcc-dev/neo-go v0.98.0/go.mod h1:E3cc1x6RXSXrJb2nDWXTXjnXk3rIqVN8YdFyWv+FrqM=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220921145301-29564bdda2e9 h1:IGfqrLp2BR1jMpOL+uFzPRO5PrUPD5vCdkC42atMMFI=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220921145301-29564bdda2e9/go.mod h1:23bBw0v6pBYcrWs8CBEEDIEDJNbcFoIh8pGGcf2Vv8s=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220927123257-24c107e3a262 h1:UTmSLZw5OpD/JPE1B5Vf98GF0zu2/Hsqq1lGLtStTUE=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220927123257-24c107e3a262/go.mod h1:23bBw0v6pBYcrWs8CBEEDIEDJNbcFoIh8pGGcf2Vv8s=
|
||||
github.com/nspcc-dev/neofs-api-go/v2 v2.11.0-pre.0.20211201134523-3604d96f3fe1/go.mod h1:oS8dycEh8PPf2Jjp6+8dlwWyEv2Dy77h/XhhcdxYEFs=
|
||||
github.com/nspcc-dev/neofs-api-go/v2 v2.11.1 h1:SVqc523pZsSaS9vnPS1mm3VV6b6xY0gvdA0uYJ/GWZQ=
|
||||
github.com/nspcc-dev/neofs-api-go/v2 v2.11.1/go.mod h1:oS8dycEh8PPf2Jjp6+8dlwWyEv2Dy77h/XhhcdxYEFs=
|
||||
|
|
|
@ -2,4 +2,4 @@ module github.com/nspcc-dev/neo-go/examples/oracle
|
|||
|
||||
go 1.17
|
||||
|
||||
require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220921145301-29564bdda2e9
|
||||
require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220927123257-24c107e3a262
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220921145301-29564bdda2e9 h1:IGfqrLp2BR1jMpOL+uFzPRO5PrUPD5vCdkC42atMMFI=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220921145301-29564bdda2e9/go.mod h1:23bBw0v6pBYcrWs8CBEEDIEDJNbcFoIh8pGGcf2Vv8s=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220927123257-24c107e3a262 h1:UTmSLZw5OpD/JPE1B5Vf98GF0zu2/Hsqq1lGLtStTUE=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220927123257-24c107e3a262/go.mod h1:23bBw0v6pBYcrWs8CBEEDIEDJNbcFoIh8pGGcf2Vv8s=
|
||||
|
|
|
@ -1819,7 +1819,7 @@ func (c *codegen) convertBuiltin(expr *ast.CallExpr) {
|
|||
emit.Opcodes(c.prog.BinWriter, opcode.DROP, opcode.PUSH0)
|
||||
case "append":
|
||||
arg := expr.Args[0]
|
||||
typ := c.typeInfo.Types[arg].Type
|
||||
typ := c.typeOf(arg)
|
||||
ast.Walk(c, arg)
|
||||
emit.Opcodes(c.prog.BinWriter, opcode.DUP, opcode.ISNULL)
|
||||
if isByteSlice(typ) {
|
||||
|
|
|
@ -432,3 +432,24 @@ func TestInlineDoubleConditionalReturn(t *testing.T) {
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestInlineAppendStatement(t *testing.T) {
|
||||
src := `package foo
|
||||
import "github.com/nspcc-dev/neo-go/pkg/compiler/testdata/inline"
|
||||
|
||||
func Main() []byte {
|
||||
val := []byte{4, 5, 6}
|
||||
return inline.AppendInsideInline(val)
|
||||
}`
|
||||
eval(t, src, []byte{1, 2, 3, 4, 5, 6})
|
||||
}
|
||||
|
||||
func TestInlineForeignType(t *testing.T) {
|
||||
src := `package foo
|
||||
import "github.com/nspcc-dev/neo-go/pkg/compiler/testdata/inline"
|
||||
|
||||
func Main() int {
|
||||
return inline.ForeignTypeInsideInline()
|
||||
}`
|
||||
eval(t, src, big.NewInt(29))
|
||||
}
|
||||
|
|
9
pkg/compiler/testdata/inline/inline.go
vendored
9
pkg/compiler/testdata/inline/inline.go
vendored
|
@ -64,3 +64,12 @@ func NewT() T {
|
|||
func (t T) GetN() int {
|
||||
return t.N
|
||||
}
|
||||
|
||||
func AppendInsideInline(val []byte) []byte {
|
||||
inlinedType := []byte{1, 2, 3}
|
||||
return append(inlinedType, val...)
|
||||
}
|
||||
|
||||
func ForeignTypeInsideInline() int {
|
||||
return a.GetA()
|
||||
}
|
||||
|
|
|
@ -29,8 +29,6 @@ func FromHash160(hash interop.Hash160) string {
|
|||
if len(hash) != interop.Hash160Len {
|
||||
panic("invalid Hash160 length")
|
||||
}
|
||||
var res = make([]byte, interop.Hash160Len+1)
|
||||
res[0] = byte(runtime.GetAddressVersion())
|
||||
copy(res[1:], hash) // @fixme #2696
|
||||
res := append([]byte{byte(runtime.GetAddressVersion())}, hash...)
|
||||
return std.Base58CheckEncode(res)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue