<variable1> of type Variant is being forced to Scalar.
The VBUC typing engine is able to infer the correct data type of undefined or Variant-type variables, and assign them the correct data type. In some scenarios, a variant-type variable is upgraded to a scalar value; this type inference is done over the variable usage and context.
This issue doesn't have any recommendations.
Public Sub ForcedToScalar(b As Boolean)
Dim v As Variant
If b Then
Set v = Form1
MsgBox v / 3
Set v = Class1
PublicSub ForcedToScalar(ByRef b AsBoolean)
Dim Class1 As Form1
Dim v As Form1
If b Then
v = Me
'UPGRADE_WARNING: (1068) v of type Form1 is being forced to Double.
MessageBox.Show(CStr(CDbl(v) / 3), Application.ProductName)
v = Class1
'UPGRADE_WARNING: (1068) v of type Form1 is being forced to String.
publicvoid ForcedToScalar( bool b)
Form1 Class1 = null;
Form1 v = null;
v = Form1.DefInstance;
//UPGRADE_WARNING: (1068) v of type Form1 is being forced to double.
MessageBox.Show((((double) v) / 3).ToString(), Application.ProductName);
v = Class1;
//UPGRADE_WARNING: (1068) v of type Form1 is being forced to string.
MessageBox.Show((string) v, Application.ProductName);