1
0
Fork 0
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:
Brian Fiete 2022-02-16 18:28:23 -05:00
parent 1cd198cea9
commit 434a7406de
22 changed files with 394 additions and 86 deletions

View file

@ -0,0 +1,5 @@
FileVersion = 1
[Project]
Name = "Bug"
StartupObject = "Bug.Program"

View file

@ -0,0 +1,6 @@
FileVersion = 1
Projects = {Bug = {Path = "."}}
[Workspace]
StartupProject = "Bug"

View 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()

View file

@ -0,0 +1,18 @@
using System;
namespace Bug
{
class Gen
{
public static Type Get()
{
//*Void
return typeof(void);
/*@*/
/*String
return typeof(String);
*/
}
}
}

View 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;
}
}
}

View file

@ -0,0 +1,5 @@
FileVersion = 1
[Project]
Name = "Bug"
StartupObject = "Bug.Program"

View file

@ -0,0 +1,6 @@
FileVersion = 1
Projects = {Bug = {Path = "."}}
[Workspace]
StartupProject = "Bug"

View 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()

View file

@ -0,0 +1,18 @@
using System;
namespace Bug
{
class Gen
{
public static Type Get()
{
//*ClassA
return typeof(ClassA);
/*@*/
/*ClassB
return typeof(ClassB);
*/
}
}
}

View 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;
}
}
}