Skip to content

Commit

Permalink
More test samples of quirky UnrealScript.
Browse files Browse the repository at this point in the history
  • Loading branch information
EliotVU committed Nov 8, 2021
1 parent 87c7dca commit d6b60b4
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 2 deletions.
26 changes: 26 additions & 0 deletions grammars/examples/Classes/AmbiguousAccessTest.uc
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
class AmbiguousAccessTest extends Object;

struct TestStruct {
var Vector default;
};

/** The 'default' specifier is ambiguous when used on a struct. */
function AmbiguousAccessTest() {
local TestStruct test;
local Vector V;

// Working as expected
v = test.default;

// Missing support.
test.default.X;

// false positive, the linter should output an error.
v = test.default.default;

v = TestStruct().default;
TestStruct().default.X;
TestStruct().default.default;
}

function TestStruct TestStruct();
11 changes: 9 additions & 2 deletions grammars/examples/Classes/AmbiguousCastTest.uc
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
class AmbiguousCastTest extends Object;

struct AmbiguousStruct {

};

// Working as intended: Expected behavior: cast to self (error)
function AmbiguousCastTest(object obj) {
function AmbiguousCastTest(Object obj) {
AmbiguousCastTest(self);
}
AmbiguousStruct(self);
}

function AmbiguousStruct(Object obj);

0 comments on commit d6b60b4

Please sign in to comment.