The issue can best be demonstrated in the following stripped down code. When you use the following code in a regular (non-class method) then everything will work fine. When you use this code in the method of a class then the LogViewer will say "dyn_mixed, Given datatype does not match with needed type 'dyn_string'" ????
Code: Select all
class MyClass{
public dyn_string ConvertAMixedToADynString()
{
dyn_mixed dmJustADummyMixed = makeDynMixed( 12, "hello", 3.14 );
return dmJustADummyMixed; // <==================
}
}
- a class method with return type dyn_string doesn't like it when you return a dyn_mixed ?
- a regular function is ok with this !
- the sample code shown below works fine in 3.16 !
Here's a full working demo ! (just paste in a panel)
Code: Select all
class MyDemoClass{
// This class demonstrates na issue that we
// encountered when upgrading to 3.17 !
// Note how the method 'MyDemoClass.ConvertAMixedToADynString'
// is exactly the same as the 'regular' (non class method) function 'ConvertAMixedToADynString'
public dyn_string ConvertAMixedToADynString()
{
dyn_mixed dmJustADummyMixed = makeDynMixed( 12, "hello", 3.14 );
// The following line will cause a warning in the LogViewer
// 'WARNING, 28/ctrl, dyn_mixed, Given datatype does not match with needed type 'dyn_string''
//
// NOTE: When you run this code in 3.16 then you will not get any warning !??
return dmJustADummyMixed;
// You can 'fix' (of workaround) this issue
// by specifying
// return (dyn_string)dmJustADummyMixed;
// ^^^^^^^^^^^
}
};
dyn_string ConvertAMixedToADynString()
{
// This function will work perfectly fine. It will convert
// the 'dyn_mixed' to a 'dyn_string' (and there will be no warnings !
dyn_mixed dmJustADummyMixed = makeDynMixed( 55, "World", 2.35 );
return dmJustADummyMixed;
}
main()
{
// we noticed that one of our class methods would suddenly produce warnings
// in the LogViewer. Our function would actually do something
// like:
// dyn-string GetDataSources()
// {
// return mappingKeys( m3bDBDatabase.datasources );;
// }
// NOTE that this method worked perfectly fine in 3.16 !
// We first call the regular function (non class method)
// Works fine, no warnings in the logviewer
dyn_string dstrData = ConvertAMixedToADynString();
DebugN( "Result from regular function = " + dstrData );
// The class method is exactly the same
// But now there's a warning in the LogViewer !
// 'WARNING, 28/ctrl, dyn_mixed, Given datatype does not match with needed type 'dyn_string''
MyDemoClass demo1;
dstrData = demo1.ConvertAMixedToADynString();
DebugN( "same code from a class = " + dstrData );
// Both the regular function and the class method
// will return the proper data.
// The only issue is that the class method gives the warning ! (since 3.17P004)
}
Share the fun
Frenk Mulder