This PR ensures the resulting Solidity output for function type parameters will always be valid.
In cases where the internalType field is provided, this change uses that field directly for best results. Since that field is not part of the ABI JSON spec, then in cases where it's not provided, this PR falls back to behavior of specifying the minimally-valid function() external type alongside a warning.
Example missing `internalType` fallback output
```solidity
// SPDX-License-Identifier: UNLICENSED
// !! THIS FILE WAS AUTOGENERATED BY abi-to-sol v0.6.2. SEE SOURCE BELOW. !!
pragma solidity >=0.7.0 <0.9.0;
interface MyInterface {
function map(
/* warning: the following type may be incomplete. the receiving contract may expect additional input or output parameters. */
function() f,
uint256[] memory list
) external pure returns (uint256[] memory);
}
// THIS FILE WAS AUTOGENERATED FROM THE FOLLOWING ABI JSON:
/*
[{"inputs":[{"name":"f","type":"function"},{"internalType":"uint256[]","name":"list","type":"uint256[]"}],"name":"map","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"pure","type":"function"}]
*/
```
Addresses #76, originally raised by @esaulpaugh.
This PR ensures the resulting Solidity output for function type parameters will always be valid.
In cases where the
internalType
field is provided, this change uses that field directly for best results. Since that field is not part of the ABI JSON spec, then in cases where it's not provided, this PR falls back to behavior of specifying the minimally-validfunction() external
type alongside a warning.Example missing `internalType` fallback output
```solidity // SPDX-License-Identifier: UNLICENSED // !! THIS FILE WAS AUTOGENERATED BY abi-to-sol v0.6.2. SEE SOURCE BELOW. !! pragma solidity >=0.7.0 <0.9.0; interface MyInterface { function map( /* warning: the following type may be incomplete. the receiving contract may expect additional input or output parameters. */ function() f, uint256[] memory list ) external pure returns (uint256[] memory); } // THIS FILE WAS AUTOGENERATED FROM THE FOLLOWING ABI JSON: /* [{"inputs":[{"name":"f","type":"function"},{"internalType":"uint256[]","name":"list","type":"uint256[]"}],"name":"map","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"pure","type":"function"}] */ ```