diff --git a/BeefTools/TestDLL/TestDLL.cpp b/BeefTools/TestDLL/TestDLL.cpp index fc8d64e0..37b24a81 100644 --- a/BeefTools/TestDLL/TestDLL.cpp +++ b/BeefTools/TestDLL/TestDLL.cpp @@ -56,7 +56,7 @@ struct StructB }; -struct [[nodiscard]] StructA +struct StructA { StructB* mSB; @@ -72,7 +72,6 @@ struct [[nodiscard]] StructA } }; -[[nodiscard]] int GetVal() { return 9; @@ -83,20 +82,78 @@ StructA GetSA() return StructA(); } +int Zorq() +{ + int zaf = 123; + return 0; +} + +struct Base +{ + int32_t mA; + int64_t mB; +}; + +struct Derived : Base +{ + int8_t mC; + + int GetC() + { + return mC + 10000; + } +}; + +struct Int +{ + int64_t mVal; +}; + +void Zorq2() +{ + Derived dr; + dr.mA = 1; + dr.mB = 2; + dr.mC = 3; + dr.GetC(); + Int iVal; + iVal.mVal = 88; + + int64_t q = 999; +} + +void Zorq3() +{ + Derived dr; + dr.mA = 1; + dr.mB = 2; + dr.mC = 3; + Int iVal; + iVal.mVal = 88; + + int64_t q = 999; +} + // THIS IS VERSION 6. extern "C" __declspec(dllexport) void Test2(int aa, int bb, int cc, int dd) { + Zorq(); + Zorq2(); + Zorq3(); + GetVal(); GetSA(); //Sleep(10000); + int zed = 999; + StructA sa; sa.mSB = NULL; Sleep(200); - sa.GetVal(); - sa.GetWithSleep(); + //sa.GetVal(); + //sa.GetWithSleep(); //auto val = sa.mSB->mStr; std::string str = "Hey Dude"; diff --git a/IDE/Tests/Test1/src/Data01.bf b/IDE/Tests/Test1/src/Data01.bf index ebee7d49..7c2ba692 100644 --- a/IDE/Tests/Test1/src/Data01.bf +++ b/IDE/Tests/Test1/src/Data01.bf @@ -23,6 +23,8 @@ namespace IDETest Derived dr = .(); Int iVal = (.)123; + int q = 999; + //Test_End } } diff --git a/IDEHelper/Tests/LibA/src/LibA0.bf b/IDEHelper/Tests/LibA/src/LibA0.bf index 80efa186..da00e27a 100644 --- a/IDEHelper/Tests/LibA/src/LibA0.bf +++ b/IDEHelper/Tests/LibA/src/LibA0.bf @@ -31,9 +31,17 @@ class LibClassA { return 9; } + + public static int GetVal3(Object obj) + { + return 30; + } } class LibClassB { - //public uint8* mA = append uint8[10]; + public static int DoGetVal3(T val) + { + return LibClassA.GetVal3(val); + } } \ No newline at end of file diff --git a/IDEHelper/Tests/src/Extensions.bf b/IDEHelper/Tests/src/Extensions.bf index bb54288f..fc65e32d 100644 --- a/IDEHelper/Tests/src/Extensions.bf +++ b/IDEHelper/Tests/src/Extensions.bf @@ -1,3 +1,5 @@ +#pragma warning disable 168 + using System; namespace System.Collections.Generic @@ -24,6 +26,14 @@ namespace System.Collections.Generic } } +extension LibClassA +{ + public static int GetVal3(T val) + { + return 31; + } +} + namespace Tests { class Extensions @@ -170,5 +180,17 @@ namespace Tests Test.Assert(ca.LibB_GetB() == 8); Test.Assert(ca.LibC_GetB() == 30013); } + + [Test] + public static void TestExtensionOverride() + { + int a = 123; + int directResult = LibClassA.GetVal3(a); + Test.Assert(directResult == 31); + // This should only call the LibA version since the LibA:LibClassB.DoGetVal3 won't have + // access to call the Tests:LibClassB.DoGetVal3 + int indirectResult = LibClassB.DoGetVal3(a); + Test.Assert(directResult == 30); + } } }