Skip to content

Commit

Permalink
Suppress 'Unbound global variable' warning in IsBound
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisJefferson committed May 12, 2017
1 parent 24ae980 commit 4398c7b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/read.c
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,7 @@ void ReadCallVarAss (
WarnOnUnboundGlobalsRNam = RNamName("WarnOnUnboundGlobals");

if ( type == 'g'
&& mode != 'i'
&& STATE(CountNams) != 0
&& var != STATE(CurrLHSGVar)
&& VAL_GVAR(var) == 0
Expand Down
17 changes: 17 additions & 0 deletions tst/testinstall/bound.tst
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,21 @@ gap> f := ( -> IsBound(r.b) );; f();
true
gap> f := ( -> IsBound(r.c) );; f();
false
gap> f := ( -> IsBound(BADVARNAME) );; f();
false
gap> f := ( -> IsBound(BADVARNAME.BADRECNAME) );;
gap> f();
Error, Variable: 'BADVARNAME' must have an assigned value
gap> f := ( -> BADVARNAME );;
Syntax warning: Unbound global variable in stream:1
f := ( -> BADVARNAME );;
^
gap> f();
Error, Variable: 'BADVARNAME' must have an assigned value
gap> f := ( -> IsBound(BADVARNAME[BADLISTNAME]) );;
Syntax warning: Unbound global variable in stream:1
f := ( -> IsBound(BADVARNAME[BADLISTNAME]) );;
^
gap> f();
Error, Variable: 'BADVARNAME' must have an assigned value
gap> STOP_TEST("bound.tst", 1);

0 comments on commit 4398c7b

Please sign in to comment.