Skip to content

Commit cc4696e

Browse files
committed
Panic since no more InternalValidate
1 parent 8e18e29 commit cc4696e

File tree

1 file changed

+3
-17
lines changed

1 file changed

+3
-17
lines changed

internal/configs/configschema/implied_type.go

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ import (
88
// configuration block using the receiving block schema.
99
//
1010
// ImpliedType always returns a result, even if the given schema is
11-
// inconsistent. Code that creates configschema.Block objects should be
12-
// tested using the InternalValidate method to detect any inconsistencies
13-
// that would cause this method to fall back on defaults and assumptions.
11+
// inconsistent.
1412
func (b *Block) ImpliedType() cty.Type {
1513
if b == nil {
1614
return cty.EmptyObject
@@ -24,11 +22,7 @@ func (b *Block) ImpliedType() cty.Type {
2422

2523
for name, blockS := range b.BlockTypes {
2624
if _, exists := atys[name]; exists {
27-
// This indicates an invalid schema, since it's not valid to
28-
// define both an attribute and a block type of the same name.
29-
// However, we don't raise this here since it's checked by
30-
// InternalValidate.
31-
continue
25+
panic("invalid schema, blocks and attributes cannot have the same name")
3226
}
3327

3428
childType := blockS.Block.ImpliedType()
@@ -49,12 +43,6 @@ func (b *Block) ImpliedType() cty.Type {
4943
atys[name] = cty.List(childType)
5044
}
5145
case NestingSet:
52-
// We forbid dynamically-typed attributes inside NestingSet in
53-
// InternalValidate, so we will consider that a bug in the caller
54-
// if we see it here. (There is no set equivalent to tuple and
55-
// object types, because cty's set implementation depends on
56-
// knowing the static type in order to properly compute its
57-
// internal hashes.)
5846
if childType.HasDynamicTypes() {
5947
panic("can't use cty.DynamicPseudoType inside a block type with NestingSet")
6048
}
@@ -72,9 +60,7 @@ func (b *Block) ImpliedType() cty.Type {
7260
atys[name] = cty.Map(childType)
7361
}
7462
default:
75-
// Invalid nesting type is just ignored. It's checked by
76-
// InternalValidate.
77-
continue
63+
panic("invalid nesting type")
7864
}
7965
}
8066

0 commit comments

Comments
 (0)