mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Fix checks for "using for ... global" for libraries.
This commit is contained in:
@@ -4,4 +4,3 @@ contract C {
|
||||
function f(uint) pure{}
|
||||
// ----
|
||||
// SyntaxError 3367: (17-43): "global" can only be used at file level.
|
||||
// TypeError 8841: (17-43): Can only use "global" with user-defined types.
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
using L for uint global;
|
||||
using L for uint[] global;
|
||||
using L for function() returns (uint) global;
|
||||
library L {
|
||||
}
|
||||
// ----
|
||||
// TypeError 8841: (0-24): Can only use "global" with user-defined types.
|
||||
// TypeError 8841: (25-51): Can only use "global" with user-defined types.
|
||||
// TypeError 8841: (52-97): Can only use "global" with user-defined types.
|
||||
@@ -0,0 +1,6 @@
|
||||
using L for L.S global;
|
||||
library L {
|
||||
struct S { uint x; }
|
||||
}
|
||||
// ----
|
||||
// TypeError 4117: (0-23): Can only use "global" with types defined in the same source unit at file level.
|
||||
@@ -0,0 +1,6 @@
|
||||
interface I {}
|
||||
using L for I global;
|
||||
library L {
|
||||
}
|
||||
// ----
|
||||
// TypeError 8841: (15-36): Can only use "global" with user-defined types.
|
||||
@@ -0,0 +1,8 @@
|
||||
==== Source: A ====
|
||||
struct S { uint x; }
|
||||
==== Source: B ====
|
||||
library L {}
|
||||
using L for S global;
|
||||
import {S} from "A";
|
||||
// ----
|
||||
// TypeError 4117: (B:13-34): Can only use "global" with types defined in the same source unit at file level.
|
||||
@@ -0,0 +1,5 @@
|
||||
using L for * global;
|
||||
library L {}
|
||||
// ----
|
||||
// SyntaxError 8118: (0-21): The type has to be specified explicitly at file level (cannot use '*').
|
||||
// SyntaxError 2854: (0-21): Can only globally bind functions to specific types.
|
||||
@@ -0,0 +1,5 @@
|
||||
using {f} for * global;
|
||||
function f(uint) pure{}
|
||||
// ----
|
||||
// SyntaxError 8118: (0-23): The type has to be specified explicitly at file level (cannot use '*').
|
||||
// SyntaxError 2854: (0-23): Can only globally bind functions to specific types.
|
||||
Reference in New Issue
Block a user