Class: Dhall::TypeChecker::TextLiteral
- Inherits:
-
Object
- Object
- Dhall::TypeChecker::TextLiteral
- Defined in:
- lib/dhall/typecheck.rb
Defined Under Namespace
Classes: Chunks
Instance Method Summary collapse
- #annotate(context) ⇒ Object
-
#initialize(lit) ⇒ TextLiteral
constructor
A new instance of TextLiteral.
Constructor Details
#initialize(lit) ⇒ TextLiteral
Returns a new instance of TextLiteral.
121 122 123 |
# File 'lib/dhall/typecheck.rb', line 121 def initialize(lit) @lit = lit end |
Instance Method Details
#annotate(context) ⇒ Object
145 146 147 148 149 150 151 152 153 154 155 156 157 |
# File 'lib/dhall/typecheck.rb', line 145 def annotate(context) chunks = Chunks.new(@lit.chunks).map { |c| TypeChecker.for(c).annotate(context).tap do |annotated| TypeChecker.assert annotated.type, Builtins[:Text], "Cannot interpolate #{annotated.type}" end }.to_a Dhall::TypeAnnotation.new( value: @lit.with(chunks: chunks), type: Builtins[:Text] ) end |