hardhat-vscode icon indicating copy to clipboard operation
hardhat-vscode copied to clipboard

Implement interface edge case

Open kanej opened this issue 3 years ago • 0 comments
trafficstars

To reproduce:

// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;

interface IExample {
  function another() external pure;

  function another2() external pure;
}

abstract contract Example {
  constructor() {}

  function another() external pure virtual;
}

contract Extender is IExample, Example {
  constructor() {}

  function another() external pure override(Example, IExample) {}

  // function another2() external pure override {}
}

This creates a error with our implement interfaces quickfix. The result has an additional function:

// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;

interface IExample {
  function another() external pure;

  function another2() external pure;
}

abstract contract Example {
  constructor() {}

  function another() external pure virtual;
}

contract Extender is IExample, Example {
  constructor() {}

  function another() external pure override(Example, IExample) {}

  function another() external pure override(Example, IExample) {}

  function another2() external pure override {}
}

The comparison logic to see if the function is already implemented needs to be looked at.

kanej avatar Mar 08 '22 09:03 kanej