Skip to content

Commit 2fb35e7

Browse files
committed
update doc
1 parent 80c2c2b commit 2fb35e7

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

internal/reflect/slice.go

+10
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,12 @@ func reflectSlice(ctx context.Context, typ attr.Type, val tftypes.Value, target
9090
}
9191

9292
return slice, diags
93+
9394
// Tuple reflection into slices is currently limited to use-cases where all tuple element types are the same.
95+
//
96+
// Overall, Tuple support is limited in the framework, but the main path that executes tuple reflection is the provider-defined function variadic
97+
// parameter. All tuple elements in this variadic parameter will have the same element type. For use-cases where the variadic parameter is a dynamic type,
98+
// all elements will have the same type of `DynamicType` and value of `DynamicValue`, with an underlying value that may be different.
9499
case attr.TypeWithElementTypes:
95100
// we need to know the type the slice is wrapping
96101
elemType := target.Type().Elem()
@@ -240,7 +245,12 @@ func FromSlice(ctx context.Context, typ attr.Type, val reflect.Value, path path.
240245

241246
tfElems = append(tfElems, tfVal)
242247
}
248+
243249
// Tuple reflection from slices is currently limited to use-cases where all tuple element types are the same.
250+
//
251+
// Overall, Tuple support is limited in the framework, but the main path that executes tuple reflection is the provider-defined function variadic
252+
// parameter. All tuple elements in this variadic parameter will have the same element type. For use-cases where the variadic parameter is a dynamic type,
253+
// all elements will have the same type of `DynamicType` and value of `DynamicValue`, with an underlying value that may be different.
244254
case attr.TypeWithElementTypes:
245255
if len(t.ElementTypes()) <= 0 {
246256
// If the tuple values are empty as well, we can just pass back an empty slice of the type we received.

0 commit comments

Comments
 (0)