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

feat: make all type conversions public #302

Merged
merged 1 commit into from
Nov 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1296,27 +1296,15 @@ protected TypeConverter buildConverterFromMethodBodies(
}
final String cSharpType = type;



// TODO It may be more stable to have _all_ converters be public.
// Right now the expectation is that a reference to a resource
// is the _only_ way to share types.
// By making them all public the surface area is increased.

// For any module that takes a dependency on this module,
// they will need to wrap and unwrap reference types.
// This is more controlled than exposing
// the NativeWrapper and the Dafny wrapped type.
// However, if this type is already exposed
// from a dependent module
// leave that as the _only_ public converter
// and this converter is internal.
final boolean isDependantModuleType = ModelUtils.isReferenceDependantModuleType(shape,
nameResolver.namespaceForService());

final String visibility = shape.hasTrait(ReferenceTrait.class) && !isDependantModuleType
? "public"
: "internal";
// Make all converters public, because most need to be and it's not worth the trouble to hide the remaining few.
final String visibility = "public";

final String fromDafnyConverterName = typeConverterForShape(id, FROM_DAFNY);
final TokenTree fromDafnyConverterSignature = TokenTree.of(
Expand Down
Loading