@@ -502,16 +502,31 @@ func TestFromAttributeValue(t *testing.T) {
502502 CreatedBy : testtypes.BoolType {},
503503 },
504504 },
505+ "BoolTypable-BoolValue" : {
506+ typ : testtypes.BoolTypeWithSemanticEquals {},
507+ val : types .BoolNull (),
508+ expected : types .BoolNull (),
509+ },
505510 "Float64Type-Float64Value" : {
506511 typ : types .Float64Type ,
507512 val : types .Float64Null (),
508513 expected : types .Float64Null (),
509514 },
515+ "Float64Typable-Float64Value" : {
516+ typ : testtypes.Float64TypeWithSemanticEquals {},
517+ val : types .Float64Null (),
518+ expected : types .Float64Null (),
519+ },
510520 "Int64Type-Int64Value" : {
511521 typ : types .Int64Type ,
512522 val : types .Int64Null (),
513523 expected : types .Int64Null (),
514524 },
525+ "Int64Typable-Int64Value" : {
526+ typ : testtypes.Int64TypeWithSemanticEquals {},
527+ val : types .Int64Null (),
528+ expected : types .Int64Null (),
529+ },
515530 "ListType-ListValue-matching-elements" : {
516531 typ : types.ListType {ElemType : types .StringType },
517532 val : types .ListNull (types .StringType ),
@@ -527,12 +542,19 @@ func TestFromAttributeValue(t *testing.T) {
527542 "Value Conversion Error" ,
528543 "An unexpected error was encountered while verifying an attribute value matched its expected type to prevent unexpected behavior or panics. " +
529544 "This is always an error in the provider. Please report the following to the provider developer:\n \n " +
530- "Expected type: types.ListType[basetypes.StringType]\n " +
531- "Value type: types.ListType[basetypes.BoolType]\n " +
545+ "Expected framework type from provider logic : types.ListType[basetypes.StringType] / underlying type: tftypes.List[tftypes.String ]\n " +
546+ "Received framework type from provider logic : types.ListType[basetypes.BoolType] / underlying type: tftypes.List[tftypes.Bool ]\n " +
532547 "Path: test" ,
533548 ),
534549 },
535550 },
551+ "ListTypable-ListValue-matching-elements" : {
552+ typ : testtypes.ListType {
553+ ListType : types.ListType {ElemType : types .StringType },
554+ },
555+ val : types .ListNull (types .StringType ),
556+ expected : types .ListNull (types .StringType ),
557+ },
536558 "MapType-MapValue-matching-elements" : {
537559 typ : types.MapType {ElemType : types .StringType },
538560 val : types .MapNull (types .StringType ),
@@ -548,12 +570,19 @@ func TestFromAttributeValue(t *testing.T) {
548570 "Value Conversion Error" ,
549571 "An unexpected error was encountered while verifying an attribute value matched its expected type to prevent unexpected behavior or panics. " +
550572 "This is always an error in the provider. Please report the following to the provider developer:\n \n " +
551- "Expected type: types.MapType[basetypes.StringType]\n " +
552- "Value type: types.MapType[basetypes.BoolType]\n " +
573+ "Expected framework type from provider logic : types.MapType[basetypes.StringType] / underlying type: tftypes.Map[tftypes.String ]\n " +
574+ "Received framework type from provider logic : types.MapType[basetypes.BoolType] / underlying type: tftypes.Map[tftypes.Bool ]\n " +
553575 "Path: test" ,
554576 ),
555577 },
556578 },
579+ "MapTypable-MapValue-matching-elements" : {
580+ typ : testtypes.MapType {
581+ MapType : types.MapType {ElemType : types .StringType },
582+ },
583+ val : types .MapNull (types .StringType ),
584+ expected : types .MapNull (types .StringType ),
585+ },
557586 "NumberType-NumberValue" : {
558587 typ : types .NumberType ,
559588 val : types .NumberNull (),
@@ -568,6 +597,11 @@ func TestFromAttributeValue(t *testing.T) {
568597 CreatedBy : testtypes.NumberType {},
569598 },
570599 },
600+ "NumberTypable-NumberValue" : {
601+ typ : testtypes.NumberTypeWithSemanticEquals {},
602+ val : types .NumberNull (),
603+ expected : types .NumberNull (),
604+ },
571605 "ObjectType-ObjectValue-matching-attributes" : {
572606 typ : types.ObjectType {AttrTypes : map [string ]attr.Type {"test_attr" : types .StringType }},
573607 val : types .ObjectNull (map [string ]attr.Type {"test_attr" : types .StringType }),
@@ -583,8 +617,8 @@ func TestFromAttributeValue(t *testing.T) {
583617 "Value Conversion Error" ,
584618 "An unexpected error was encountered while verifying an attribute value matched its expected type to prevent unexpected behavior or panics. " +
585619 "This is always an error in the provider. Please report the following to the provider developer:\n \n " +
586- "Expected type: types.ObjectType[\" test_attr\" :basetypes.StringType]\n " +
587- "Value type: types.ObjectType[\" not_test_attr\" :basetypes.StringType]\n " +
620+ "Expected framework type from provider logic : types.ObjectType[\" test_attr\" :basetypes.StringType] / underlying type: tftypes.Object[ \" test_attr \" :tftypes.String ]\n " +
621+ "Received framework type from provider logic : types.ObjectType[\" not_test_attr\" :basetypes.StringType] / underlying type: tftypes.Object[ \" not_test_attr \" :tftypes.String ]\n " +
588622 "Path: test" ,
589623 ),
590624 },
@@ -599,12 +633,19 @@ func TestFromAttributeValue(t *testing.T) {
599633 "Value Conversion Error" ,
600634 "An unexpected error was encountered while verifying an attribute value matched its expected type to prevent unexpected behavior or panics. " +
601635 "This is always an error in the provider. Please report the following to the provider developer:\n \n " +
602- "Expected type: types.ObjectType[\" test_attr\" :basetypes.StringType]\n " +
603- "Value type: types.ObjectType[\" test_attr\" :basetypes.BoolType]\n " +
636+ "Expected framework type from provider logic : types.ObjectType[\" test_attr\" :basetypes.StringType] / underlying type: tftypes.Object[ \" test_attr \" :tftypes.String ]\n " +
637+ "Received framework type from provider logic : types.ObjectType[\" test_attr\" :basetypes.BoolType] / underlying type: tftypes.Object[ \" test_attr \" :tftypes.Bool ]\n " +
604638 "Path: test" ,
605639 ),
606640 },
607641 },
642+ "ObjectTypable-ObjectValue-matching-attributes" : {
643+ typ : testtypes.ObjectType {
644+ ObjectType : types.ObjectType {AttrTypes : map [string ]attr.Type {"test_attr" : types .StringType }},
645+ },
646+ val : types .ObjectNull (map [string ]attr.Type {"test_attr" : types .StringType }),
647+ expected : types .ObjectNull (map [string ]attr.Type {"test_attr" : types .StringType }),
648+ },
608649 "SetType-SetValue-matching-elements" : {
609650 typ : types.SetType {ElemType : types .StringType },
610651 val : types .SetNull (types .StringType ),
@@ -620,12 +661,19 @@ func TestFromAttributeValue(t *testing.T) {
620661 "Value Conversion Error" ,
621662 "An unexpected error was encountered while verifying an attribute value matched its expected type to prevent unexpected behavior or panics. " +
622663 "This is always an error in the provider. Please report the following to the provider developer:\n \n " +
623- "Expected type: types.SetType[basetypes.StringType]\n " +
624- "Value type: types.SetType[basetypes.BoolType]\n " +
664+ "Expected framework type from provider logic : types.SetType[basetypes.StringType] / underlying type: tftypes.Set[tftypes.String ]\n " +
665+ "Received framework type from provider logic : types.SetType[basetypes.BoolType] / underlying type: tftypes.Set[tftypes.Bool ]\n " +
625666 "Path: test" ,
626667 ),
627668 },
628669 },
670+ "SetTypable-SetValue-matching-elements" : {
671+ typ : testtypes.SetType {
672+ SetType : types.SetType {ElemType : types .StringType },
673+ },
674+ val : types .SetNull (types .StringType ),
675+ expected : types .SetNull (types .StringType ),
676+ },
629677 "StringType-StringValue-null" : {
630678 typ : types .StringType ,
631679 val : types .StringNull (),
@@ -650,6 +698,11 @@ func TestFromAttributeValue(t *testing.T) {
650698 CreatedBy : testtypes.StringType {},
651699 },
652700 },
701+ "StringTypable-StringValue" : {
702+ typ : testtypes.StringTypeWithSemanticEquals {},
703+ val : types .StringNull (),
704+ expected : types .StringNull (),
705+ },
653706 }
654707
655708 for name , tc := range testCases {
0 commit comments