motoko icon indicating copy to clipboard operation
motoko copied to clipboard

Constructor stamps appearing in generated IDL

Open crusso opened this issue 6 years ago • 3 comments

The auto-generated IDL for eg, test/run-dfinity/general-type-components.as depends on internal constructor stamps.

Also, we should probably not introduce trivial bindings for prelude declared primitive types (see Int = int below).

I notice this behaviour because the test output changed due to a change in constructor stamp.

type T_14 = Int;
type Int = int;
service A {
f : () -> () oneway;
}

crusso avatar Sep 04 '19 10:09 crusso

hmm, T_14 should not be in the IDL, as the actor interface doesn't mention T. But if the interface does use T, what's the problem of having stamp in the type name? I don't have a concern as long as the stamps are unique.

chenyan-dfinity avatar Sep 04 '19 18:09 chenyan-dfinity

To me it seems wrong the have the output depend on implementation details of the compiler that are likely to change. For example, I changed the prelude and the output changed from T_16 to T_14. I guess if it doesn't affect the set of implementations described by the IDL interface we might be ok. So I guess the definition of T_14 doesn't require the implementation to provide a type component named T_14 - it's really just a local type definition for use (here, no use) within the IDL.

crusso avatar Sep 05 '19 11:09 crusso

@ggreif Can we call this one fixed in https://github.com/dfinity/motoko/pull/5013?

christoph-dfinity avatar Apr 15 '25 06:04 christoph-dfinity