Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prioritize checking canonical_name for type inference #2118

Merged
merged 1 commit into from
Oct 12, 2023

Conversation

smonicas
Copy link
Contributor

@smonicas smonicas commented Sep 7, 2023

Fix #2117.

pragma solidity 0.8.19;

interface Interface {
    struct ZZZ {
        int x;
        int y;
    }

    enum QQQ {
      A,
      B
    }
}

struct ZZZ {
    int x;
    int y;
    int z;
}

enum QQQ {
  A,
  B
}

contract A {
    function test(ZZZ memory zzz, QQQ qqq) external {
        zzz.z = 3;
        Interface.QQQ qqq2 = Interface.QQQ.A;
        Interface.ZZZ memory zzz2 = Interface.ZZZ(1,2);
    }
}

ir

Contract A
	Function A.test(ZZZ,QQQ) (*)
		Expression: zzz.z = 3
		IRs:
			REF_0(int256) -> zzz.z
			REF_0(int256) (->zzz) := 3(int256)
		Expression: qqq2 = Interface.QQQ.A
		IRs:
			REF_1(None) -> Interface.QQQ
			REF_2(None) -> REF_1.A
			qqq2(Interface.QQQ) := REF_2(None)
		Expression: zzz2 = Interface.ZZZ(1,2)
		IRs:
			TMP_0(Interface.ZZZ) = new ZZZ(1,2)
			zzz2(Interface.ZZZ) := TMP_0(Interface.ZZZ)

@montyly montyly merged commit dab60e0 into dev Oct 12, 2023
73 checks passed
@montyly montyly deleted the dev-fix-type-inference branch October 12, 2023 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants