@@ -950,6 +950,11 @@ byte 0x414c474f
950950 testProg (t , strings .Replace (text , "int 1 // account idx" , "byte \" aoeuiaoeuiaoeuiaoeuiaoeuiaoeui01\" " , - 1 ), directRefEnabledVersion - 1 ,
951951 expect {4 , "app_local_get_ex arg 0 wanted type uint64..." })
952952 testApp (t , strings .Replace (text , "int 100 // app id" , "int 2" , - 1 ), now )
953+ // Next we're testing if the use of the current app's id works
954+ // as a direct reference. The error is because the sender
955+ // account is not opted into 123.
956+ ledger .appID = basics .AppIndex (123 )
957+ testApp (t , strings .Replace (text , "int 100 // app id" , "int 123" , - 1 ), now , "no app for account" )
953958 testApp (t , strings .Replace (text , "int 100 // app id" , "int 2" , - 1 ), pre , "no app for account" )
954959 testApp (t , strings .Replace (text , "int 100 // app id" , "int 9" , - 1 ), now , "invalid App reference 9" )
955960 testApp (t , strings .Replace (text , "int 1 // account idx" , "byte \" aoeuiaoeuiaoeuiaoeuiaoeuiaoeui00\" " , - 1 ), now ,
@@ -1107,6 +1112,12 @@ int 4141
11071112 now .Txn .Txn .ApplicationID = 0
11081113 now .Txn .Txn .ForeignApps = []basics.AppIndex {100 }
11091114 testApp (t , text , now )
1115+
1116+ // Direct reference to the current app also works
1117+ ledger .appID = basics .AppIndex (100 )
1118+ now .Txn .Txn .ForeignApps = []basics.AppIndex {}
1119+ testApp (t , strings .Replace (text , "int 1 // ForeignApps index" , "int 100" , - 1 ), now )
1120+ testApp (t , strings .Replace (text , "int 1 // ForeignApps index" , "global CurrentApplicationID" , - 1 ), now )
11101121}
11111122
11121123const assetsTestProgram = `int 0//account
0 commit comments