Module: RLSL::Prism::TypeShapes

Included in:
CollectionTypeResolver, TargetCapabilityValidator, TypeEnvironment
Defined in:
lib/rlsl/prism/type_inference/type_shapes.rb

Defined Under Namespace

Classes: ArrayType

Class Method Summary collapse

Class Method Details

.array(element_type) ⇒ Object



18
19
20
# File 'lib/rlsl/prism/type_inference/type_shapes.rb', line 18

def array(element_type)
  ArrayType.new(element_type)
end

.array?(type) ⇒ Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/rlsl/prism/type_inference/type_shapes.rb', line 22

def array?(type)
  type.is_a?(ArrayType)
end

.element_type(type) ⇒ Object



26
27
28
29
30
# File 'lib/rlsl/prism/type_inference/type_shapes.rb', line 26

def element_type(type)
  return type.element_type if array?(type)

  nil
end