Skip to content

Commit 57a0b2d

Browse files
committed
Merge pull request #420 from PowerShell/PreferenceVarFixBranch
Fix for issue #417 - False positive - The variable 'OFS' is assigned …
2 parents bc1bb08 + 5dcd274 commit 57a0b2d

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

Engine/SpecialVars.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ internal class SpecialVars
3636
internal const string ExecutionContext = "ExecutionContext";
3737
internal const string Matches = "Matches";
3838
internal const string PSVersionTable = "PSVersionTable";
39+
internal const string OFS = "OFS";
3940

4041
internal static readonly string[] InitializedVariables;
4142

@@ -67,7 +68,8 @@ static SpecialVars()
6768
PSCommandPath,
6869
ExecutionContext,
6970
Matches,
70-
PSVersionTable
71+
PSVersionTable,
72+
OFS
7173
};
7274
internal static readonly Type[] AutomaticVariableTypes = new Type[]
7375
{
@@ -82,7 +84,8 @@ static SpecialVars()
8284
/* PSCommandPath */ typeof(string),
8385
/* ExecutionContext */ typeof(EngineIntrinsics),
8486
/* Matches */ typeof(System.Collections.Hashtable),
85-
/* PSVersionTable */ typeof(System.Collections.Hashtable)
87+
/* PSVersionTable */ typeof(System.Collections.Hashtable),
88+
/* OFS */ typeof(object)
8689
};
8790

8891

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
$declaredVars = "Declared Vars"
22
Write-Ouput $declaredVars
33
$script:thisshouldnotraiseerrors = "this should not raise errors"
4-
$foo.property = "This also should not raise errors"
4+
$foo.property = "This also should not raise errors"
5+
6+
# Output field separator builtin special variable
7+
$OFS = ', '
8+
[string]('apple', 'banana', 'orange')

0 commit comments

Comments
 (0)