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 343e7a7
Show file tree
Hide file tree
Showing 2 changed files with 8 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
7 changes: 7 additions & 0 deletions tst/testinstall/bound.tst
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,11 @@ 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 := ( -> IsBound(BADVARNAME[BADLISTNAME]) );;
Syntax warning: Unbound global variable in stream:1
f := ( -> IsBound(BADVARNAME[BADLISTNAME]) );;
^
gap> STOP_TEST("bound.tst", 1);

0 comments on commit 343e7a7

Please sign in to comment.