{ 跳至内容 }

Solidity 0.6.12 版本发布公告

发布于 2020 年 7 月 22 日 由 Solidity 团队

版本

Solidity v0.6.12 在使用继承和 NatSpec 注释时增加了灵活性,并对优化器进行了许多小的改进。

值得注意的新功能

NatSpec 继承

Solidity 0.6.11 版本发布公告 中所述,如果您在派生函数中没有提供任何 NatSpec 注释,则 NatSpec 注释现在会自动继承。从 Solidity 0.6.12 开始,即使您指定了一些标签,也可以使用标签@inheritdoc 从基类显式继承注释。然后,未提供的标签将从指定的基类的函数中获取。

// SPDX-License-Identifier: MIT
pragma solidity ^0.6.11;
interface Gathering {
  /// The address `participant` just registered for the gathering.
  event Registered(address participant);

  /// Registers `msg.sender` to take part in the gathering.
  /// @param name The name of the participant.
  function register(string calldata name) external;
}

contract MyGathering is Gathering {
  mapping(address => string) public participants;
  uint public participantCount;

  /// Registers `msg.sender` to take part in the gathering
  /// unless there are already more than 10 participants.
  /// @inheritdoc Gathering
  function register(string calldata name) public override {
    require(participantCount <= 10);
    participants[msg.sender] = name;
    participantCount++;
    emit Registered(msg.sender);
  }
}

上面示例代码中的派生合约 MyGathering 将拥有参数 “name” 的文档作为其开发者文档的一部分。

完整变更日志

语言功能

  • NatSpec:实现标签 @inheritdoc 以从特定基类复制文档。
  • Wasm 后端:添加 i32.ctzi64.ctzi32.popcnti64.popcnt

编译器功能

  • 代码生成器:在复制到内存时避免双重清理。
  • 代码生成器:在编译时评估字符串字面量的 keccak256
  • 优化器:添加规则以删除字节操作码内部的移位。
  • 窥视孔优化器:添加规则以删除 dup 后的交换。
  • 窥视孔优化器:删除标签的不必要掩盖。
  • Yul EVM 代码转换:在访问变量声明的右侧后直接释放堆栈槽,而不是仅在语句结束时释放。

错误修复

  • SMTChecker:修复具有静态数组类型索引的事件中的错误。
  • SMTChecker:修复在连续存储数组推送 (push().push()) 中的内部错误。
  • SMTChecker:修复在对固定字节类型使用按位运算符时的内部错误。
  • SMTChecker:修复在分支内部对数组索引使用复合按位运算符赋值时的内部错误。
  • 类型检查器:修复与超大型类型相关的内部编译器错误。
  • 类型检查器:修复与 {value: ...} 结合的重载解析。

构建系统

  • 将 jsoncpp 的内部依赖项更新为 1.9.3。

衷心感谢所有为使此版本发布做出贡献的人!

这里 下载 Solidity 的新版本。

上一篇

下一篇

参与

GitHub

Twitter

Mastodon

Matrix

发现更多

博客文档用例贡献关于论坛

2024Solidity 团队

安全策略

行为准则