mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Distinct identifiers and tokens for integer type and integer class
- Using the same name causes syntax ambiguities. It's also not allowed for user-defined classes and types.
This commit is contained in:
parent
271d55cb04
commit
353d50b0be
@ -273,7 +273,8 @@ namespace solidity::langutil
|
|||||||
K(Class, "class", 0) \
|
K(Class, "class", 0) \
|
||||||
K(Instantiation, "instantiation", 0) \
|
K(Instantiation, "instantiation", 0) \
|
||||||
K(Word, "word", 0) \
|
K(Word, "word", 0) \
|
||||||
K(Integer, "integer", 0) \
|
K(IntegerType, "integer", 0) \
|
||||||
|
K(Integer, "Integer", 0) \
|
||||||
K(Itself, "itself", 0) \
|
K(Itself, "itself", 0) \
|
||||||
K(Void, "void", 0) \
|
K(Void, "void", 0) \
|
||||||
K(Pair, "pair", 0) \
|
K(Pair, "pair", 0) \
|
||||||
@ -307,7 +308,7 @@ namespace TokenTraits
|
|||||||
constexpr bool isElementaryTypeName(Token tok)
|
constexpr bool isElementaryTypeName(Token tok)
|
||||||
{
|
{
|
||||||
return (Token::Int <= tok && tok < Token::TypesEnd) ||
|
return (Token::Int <= tok && tok < Token::TypesEnd) ||
|
||||||
tok == Token::Word || tok == Token::Void || tok == Token::Integer ||
|
tok == Token::Word || tok == Token::Void || tok == Token::IntegerType ||
|
||||||
tok == Token::Pair || tok == Token::Unit || tok == Token::Fun;
|
tok == Token::Pair || tok == Token::Unit || tok == Token::Fun;
|
||||||
}
|
}
|
||||||
constexpr bool isAssignmentOp(Token tok) { return Token::Assign <= tok && tok <= Token::AssignMod; }
|
constexpr bool isAssignmentOp(Token tok) { return Token::Assign <= tok && tok <= Token::AssignMod; }
|
||||||
|
@ -73,7 +73,7 @@ bool TypeRegistration::visit(ElementaryTypeName const& _typeName)
|
|||||||
return m_typeSystem.constructor(PrimitiveType::Pair);
|
return m_typeSystem.constructor(PrimitiveType::Pair);
|
||||||
case Token::Word:
|
case Token::Word:
|
||||||
return m_typeSystem.constructor(PrimitiveType::Word);
|
return m_typeSystem.constructor(PrimitiveType::Word);
|
||||||
case Token::Integer:
|
case Token::IntegerType:
|
||||||
return m_typeSystem.constructor(PrimitiveType::Integer);
|
return m_typeSystem.constructor(PrimitiveType::Integer);
|
||||||
case Token::Bool:
|
case Token::Bool:
|
||||||
return m_typeSystem.constructor(PrimitiveType::Bool);
|
return m_typeSystem.constructor(PrimitiveType::Bool);
|
||||||
|
@ -66,7 +66,7 @@ std::optional<TypeConstructor> experimental::typeConstructorFromToken(Analysis c
|
|||||||
return typeSystem.builtinConstructor(BuiltinType::Pair);
|
return typeSystem.builtinConstructor(BuiltinType::Pair);
|
||||||
case Token::Word:
|
case Token::Word:
|
||||||
return typeSystem.builtinConstructor(BuiltinType::Word);
|
return typeSystem.builtinConstructor(BuiltinType::Word);
|
||||||
case Token::Integer:
|
case Token::IntegerType:
|
||||||
return typeSystem.builtinConstructor(BuiltinType::Integer);
|
return typeSystem.builtinConstructor(BuiltinType::Integer);
|
||||||
case Token::Bool:
|
case Token::Bool:
|
||||||
return typeSystem.builtinConstructor(BuiltinType::Bool);
|
return typeSystem.builtinConstructor(BuiltinType::Bool);
|
||||||
|
@ -34,7 +34,7 @@ instantiation word: * {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
instantiation word: integer {
|
instantiation word: Integer {
|
||||||
function fromInteger(x:integer) -> word {
|
function fromInteger(x:integer) -> word {
|
||||||
//x + x;
|
//x + x;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user