Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0003268opensim[REGION] Scripting Enginepublic2009-03-08 01:522014-08-03 09:07
Reportersacha magne 
Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
StatusconfirmedResolutionopen 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0003268: LSL : Error CS0023: The `~' operator cannot be applied to operand of type `bool'
DescriptionThis script produce a compilation error :

string ElementType(integer linknumber)
{
    string desc = (string)llGetObjectDetails(llGetLinkKey(linknumber), [OBJECT_DESC]);
    //prim desc will be elementtype~notexture(maybe)
    list params = llParseString2List(desc, ["~"], []);
    if (~llListFindList(params, ["notexture"]) || desc == "" || desc == " " || desc == "(No Description)")
    {
        return "notexture";
    }
    else
    {
        return llList2String(llParseString2List(desc, ["~"], []), 0);
    }
}
TagsNo tags attached.
Git Revision or version number
Run Mode Grid (Multiple Regions per Sim)
Physics EngineODE
Script Engine
EnvironmentMono / Linux32
Mono VersionOther
Viewer
Attached Filespatch file icon 0001-Bind-and-operators-in-LSL-tighter-in-order-to-resolv.patch [^] (162,979 bytes) 2012-06-08 21:15 [Show Content]

- Relationships
related to 0006521new "~" logical operator cannot be applied to type "bool" 

-  Notes
(0009877)
sacha magne (developer)
2009-03-08 01:55

the line string UPMENU = "~PrevMenu~"; produce the same compil error
(0009882)
idb (manager)
2009-03-08 04:56

the first problem may be being caused by the patch from http://opensimulator.org/mantis/view.php?id=3174 [^] causing a change in precedence.
The generated code is trying to apply the ~ operator to the whole expression not just the llListFindList(params, ["notexture"]) part
(0010869)
Marcus Llewellyn (reporter)
2009-04-19 19:29

Also experiencing this issue under .NET.
(0019092)
makopoppo (manager)
2011-07-25 07:01

As of 0.7.2-dev, the issue still exists. Possible workaround would be:

----
    integer notFound = ~llListFindList(params, ["notexture"]);
    if(notFound || desc == "" || desc == " " || desc == "(No Description)")
    {
        return "notexture";
    }
----

If you use some variable temporary to store the result of tilde operation, and then use it in if clause, you can successfully compile.
(0021638)
justincc (administrator)
2012-06-08 21:14
edited on: 2012-06-08 21:14

Surrounding the first expression with parens

(~llListFindList(params, ["notexture"]))

will also work.

This is a binding problem. Attached is a patch that appears to fix it though it needs more evaluation and thought. In the lsl.parser file in opensim-libs it changes

%right EXCLAMATION TILDE INCREMENT DECREMENT
%before MINUS

to

%right INCREMENT DECREMENT
%before MINUS EXCLAMATION TILDE

before regenerating lsl.parser.cs

Evaluation of this patch would be appreciated.

(0021639)
justincc (administrator)
2012-06-08 21:16
edited on: 2012-06-08 21:17

As a further note, the last line of digits in the regenerated lsl.parser.cs needed to be changed from

1,326,3909,2,1,0};

to

1,326,3909,2,0,0};

This has been done in the patch.

(0021640)
justincc (administrator)
2012-06-08 21:19

Hmm, I really should have read what idb said earlier on. A better fix might be to address the precedence hacking that went on in Mantis 3174.
(0026662)
smxy (reporter)
2014-08-03 09:07

I have a set of scripts from SL that uses this operator in numerous places. They all fail to compile, with the error reported here. I see this has been open 5 years and idle 2, but could it be looked into again, please?

- Issue History
Date Modified Username Field Change
2009-03-08 01:52 sacha magne New Issue
2009-03-08 01:52 sacha magne SVN Revision => 8730
2009-03-08 01:52 sacha magne Run Mode => Grid (Multiple Regions per Sim)
2009-03-08 01:52 sacha magne Physics Engine => ODE
2009-03-08 01:52 sacha magne Environment => Mono / Linux32
2009-03-08 01:52 sacha magne Mono Version => Other
2009-03-08 01:55 sacha magne Note Added: 0009877
2009-03-08 04:56 idb Note Added: 0009882
2009-04-19 19:29 Marcus Llewellyn Note Added: 0010869
2011-07-25 07:01 makopoppo Note Added: 0019092
2011-07-25 07:01 makopoppo Status new => confirmed
2012-06-08 21:14 justincc Note Added: 0021638
2012-06-08 21:14 justincc Note Edited: 0021638 View Revisions
2012-06-08 21:15 justincc File Added: 0001-Bind-and-operators-in-LSL-tighter-in-order-to-resolv.patch
2012-06-08 21:16 justincc Note Added: 0021639
2012-06-08 21:17 justincc Note Edited: 0021639 View Revisions
2012-06-08 21:19 justincc Note Added: 0021640
2013-01-28 09:45 Pixel Tomsen Relationship added related to 0006521
2014-08-03 09:07 smxy Note Added: 0026662


Copyright © 2000 - 2012 MantisBT Group
Powered by Mantis Bugtracker