mirror of
https://github.com/beefytech/Beef.git
synced 2025-07-07 16:56:00 +02:00
Fixed some comptime dependency rebuilding issues with aliases/extensions
This commit is contained in:
parent
1cd198cea9
commit
434a7406de
22 changed files with 394 additions and 86 deletions
5
IDE/Tests/BugW008/BeefProj.toml
Normal file
5
IDE/Tests/BugW008/BeefProj.toml
Normal file
|
@ -0,0 +1,5 @@
|
|||
FileVersion = 1
|
||||
|
||||
[Project]
|
||||
Name = "Bug"
|
||||
StartupObject = "Bug.Program"
|
6
IDE/Tests/BugW008/BeefSpace.toml
Normal file
6
IDE/Tests/BugW008/BeefSpace.toml
Normal file
|
@ -0,0 +1,6 @@
|
|||
FileVersion = 1
|
||||
Projects = {Bug = {Path = "."}}
|
||||
|
||||
[Workspace]
|
||||
StartupProject = "Bug"
|
||||
|
15
IDE/Tests/BugW008/scripts/Test.txt
Normal file
15
IDE/Tests/BugW008/scripts/Test.txt
Normal file
|
@ -0,0 +1,15 @@
|
|||
# This tests that comptime changes to generic passed extension constraints rebuilds dependencies
|
||||
|
||||
ShowFile("src/Program.bf")
|
||||
GotoText("//End")
|
||||
ToggleBreakpoint()
|
||||
RunWithCompiling()
|
||||
AssertEvalEquals("val", "1")
|
||||
StopRunning()
|
||||
|
||||
ShowFile("src/Gen.bf")
|
||||
ToggleCommentAt("Void")
|
||||
ToggleCommentAt("String")
|
||||
RunWithCompiling()
|
||||
AssertEvalEquals("val", "2")
|
||||
StopRunning()
|
18
IDE/Tests/BugW008/src/Gen.bf
Normal file
18
IDE/Tests/BugW008/src/Gen.bf
Normal file
|
@ -0,0 +1,18 @@
|
|||
using System;
|
||||
|
||||
namespace Bug
|
||||
{
|
||||
class Gen
|
||||
{
|
||||
public static Type Get()
|
||||
{
|
||||
//*Void
|
||||
return typeof(void);
|
||||
/*@*/
|
||||
|
||||
/*String
|
||||
return typeof(String);
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
34
IDE/Tests/BugW008/src/Program.bf
Normal file
34
IDE/Tests/BugW008/src/Program.bf
Normal file
|
@ -0,0 +1,34 @@
|
|||
#pragma warning disable 168
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
namespace Bug
|
||||
{
|
||||
class Zonk<T>
|
||||
{
|
||||
public int Call(float val)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
extension Zonk<T> where comptype(Gen.Get()) : String
|
||||
{
|
||||
public int Call(int val)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
class Program
|
||||
{
|
||||
public static int Main(String[] args)
|
||||
{
|
||||
Zonk<int> zk = scope .();
|
||||
int val = zk.Call(1);
|
||||
//End
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
5
IDE/Tests/BugW009/BeefProj.toml
Normal file
5
IDE/Tests/BugW009/BeefProj.toml
Normal file
|
@ -0,0 +1,5 @@
|
|||
FileVersion = 1
|
||||
|
||||
[Project]
|
||||
Name = "Bug"
|
||||
StartupObject = "Bug.Program"
|
6
IDE/Tests/BugW009/BeefSpace.toml
Normal file
6
IDE/Tests/BugW009/BeefSpace.toml
Normal file
|
@ -0,0 +1,6 @@
|
|||
FileVersion = 1
|
||||
Projects = {Bug = {Path = "."}}
|
||||
|
||||
[Workspace]
|
||||
StartupProject = "Bug"
|
||||
|
15
IDE/Tests/BugW009/scripts/Test.txt
Normal file
15
IDE/Tests/BugW009/scripts/Test.txt
Normal file
|
@ -0,0 +1,15 @@
|
|||
# This tests that comptime alias changes rebuild dependent types
|
||||
|
||||
ShowFile("src/Program.bf")
|
||||
GotoText("//End")
|
||||
ToggleBreakpoint()
|
||||
RunWithCompiling()
|
||||
AssertEvalEquals("val", "1")
|
||||
StopRunning()
|
||||
|
||||
ShowFile("src/Gen.bf")
|
||||
ToggleCommentAt("ClassA")
|
||||
ToggleCommentAt("ClassB")
|
||||
RunWithCompiling()
|
||||
AssertEvalEquals("val", "2")
|
||||
StopRunning()
|
18
IDE/Tests/BugW009/src/Gen.bf
Normal file
18
IDE/Tests/BugW009/src/Gen.bf
Normal file
|
@ -0,0 +1,18 @@
|
|||
using System;
|
||||
|
||||
namespace Bug
|
||||
{
|
||||
class Gen
|
||||
{
|
||||
public static Type Get()
|
||||
{
|
||||
//*ClassA
|
||||
return typeof(ClassA);
|
||||
/*@*/
|
||||
|
||||
/*ClassB
|
||||
return typeof(ClassB);
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
42
IDE/Tests/BugW009/src/Program.bf
Normal file
42
IDE/Tests/BugW009/src/Program.bf
Normal file
|
@ -0,0 +1,42 @@
|
|||
#pragma warning disable 168
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
namespace Bug
|
||||
{
|
||||
class ClassA
|
||||
{
|
||||
public int Call()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
class ClassB
|
||||
{
|
||||
public int Call()
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
typealias Alias1 = comptype(Gen.Get());
|
||||
typealias Alias2 = Alias1;
|
||||
|
||||
class Zonk<T> : Alias2
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
class Program
|
||||
{
|
||||
public static int Main(String[] args)
|
||||
{
|
||||
Zonk<int> zk = scope .();
|
||||
int val = zk.Call();
|
||||
//End
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue