Added "weak" type aliases def Foo = my_foo::Foo @weak;

This commit is contained in:
Christoffer Lerno
2024-07-25 22:55:45 +02:00
parent 379637f214
commit 623dd9f3b3
13 changed files with 318 additions and 210 deletions

View File

@@ -0,0 +1,32 @@
module abc;
import std::math;
def Vec2f = std::math::vector::Vec2f @weak;
fn Vec2f foo(Vec2f a) { return a * 2; }
module gog;
import std::math;
def Vec2f = std::math::vector::Vec2f;
module deef;
import gog;
def Vec2f = gog::Vec2f @weak;
fn Vec2f foo(Vec2f a) { return a * 2; }
module test;
import abc;
import std::math;
fn void test()
{
Vec2f a;
abc::foo(a);
}
module test2;
import abc;
import deef;
fn void test2()
{
Vec2f a; // #error: abc::Vec2f or deef::Vec2f
abc::foo(a);
}

View File

@@ -0,0 +1,32 @@
module abc;
import std::math;
def Vec2f = std::math::vector::Vec2f @weak;
fn Vec2f foo(Vec2f a) { return a * 2; }
module gog;
import std::math;
def Vec2f = std::math::vector::Vec2f @weak;
module deef;
import gog;
def Vec2f = gog::Vec2f @weak;
fn Vec2f foo(Vec2f a) { return a * 2; }
module test;
import abc;
import std::math;
fn void test()
{
Vec2f a;
abc::foo(a);
}
module test2;
import abc;
import deef;
fn void test2()
{
Vec2f a;
abc::foo(a);
}

View File

@@ -23,5 +23,5 @@ fn void test2()
c = foo::b;
c = bar::b;
c = foo::a;
c = b; // #error: global variable needs a path prefix (e.g. 'bar::b')
c = b; // #error: global variable needs a path prefix (e.g. 'foo::b')
}