You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following program compiles with no warnings, as expected. Note that Foo::inner is private, but this is fine because it is only used inside Foo.
mod foo {pubstructFoo{inner:Field,}implFoo{pubfnnew(inner:Field) -> Self{Self{ inner }}}}use foo::Foo;fnmain(x:Field) -> pubFoo{Foo::new(x)}
However, if we change the call to new to be comptime, we get a warning:
mod foo {pubstructFoo{inner:Field,}implFoo{pubfnnew(inner:Field) -> Self{Self{ inner }}}}use foo::Foo;fnmain() -> pubFoo{comptime{Foo::new(5)}}
warning: inner is private and not visible from the current module
┌─ src/main.nr:16:5
│
16 │ comptime { Foo::new(5) }
│ ------------------------ inner is private
│
The text was updated successfully, but these errors were encountered:
The following program compiles with no warnings, as expected. Note that
Foo::inner
is private, but this is fine because it is only used insideFoo
.However, if we change the call to
new
to be comptime, we get a warning:The text was updated successfully, but these errors were encountered: