Skip to content

Commit 7c8d3f7

Browse files
Documentation, Codepos -> codepos
1 parent 53be75a commit 7c8d3f7

3 files changed

Lines changed: 12 additions & 8 deletions

File tree

effekt/shared/src/main/scala/effekt/source/ExplicitCapabilities.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ object ExplicitCapabilities extends Phase[Typechecked, Typechecked], Rewrite {
4545
val (ifce, op, tpe) = p.tpe match {
4646
case Some(tpe @ BlockType.InterfaceType(ifce @ BlockTypeConstructor.Interface(name, Nil, List(op), decl), Nil)) =>
4747
(ifce, op, tpe)
48-
case _ => Context.abort("Could not find Codepos interface with compatible type")
48+
case _ => Context.abort("Could not find codepos interface with compatible type")
4949
}
5050
// now, synthesize an object that always returns the current position
51-
val idIfce = IdRef(Nil, "Codepos", sp)
51+
val idIfce = IdRef(Nil, "codepos", sp)
5252
Context.annotate(Annotations.Symbol, idIfce, ifce)
5353
val idOp = IdRef(Nil, op.name.name, sp)
5454
Context.annotate(Annotations.Symbol, idOp, op)
@@ -76,7 +76,7 @@ object ExplicitCapabilities extends Phase[Typechecked, Typechecked], Rewrite {
7676

7777
// the remaining capabilities are provided as arguments
7878
val capabilityArgs = others.map{
79-
case p if p.name.name == "Codepos" =>
79+
case p if p.name.name == "codepos" =>
8080
codeposImplFor(span, p)
8181
case p => referenceToCapability(p)
8282
}
@@ -97,7 +97,7 @@ object ExplicitCapabilities extends Phase[Typechecked, Typechecked], Rewrite {
9797

9898
val capabilities = Context.annotation(Annotations.CapabilityArguments, c)
9999
val capabilityArgs = capabilities.map{
100-
case p if p.name.name == "Codepos" =>
100+
case p if p.name.name == "codepos" =>
101101
codeposImplFor(span, p)
102102
case p => referenceToCapability(p)
103103
}
@@ -116,7 +116,7 @@ object ExplicitCapabilities extends Phase[Typechecked, Typechecked], Rewrite {
116116

117117
val capabilities = Context.annotation(Annotations.CapabilityArguments, c)
118118
val capabilityArgs = capabilities.map{
119-
case p if p.name.name == "Codepos" =>
119+
case p if p.name.name == "codepos" =>
120120
codeposImplFor(span, p)
121121
case p =>
122122
referenceToCapability(p)

examples/pos/codepos.effekt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
def printCodepos(): Unit / Codepos = {
2-
println(do Codepos())
1+
def printCodepos(): Unit / codepos = {
2+
println(do codepos())
33
}
44
def main() = {
55
printCodepos()

libraries/common/effekt.effekt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -832,4 +832,8 @@ effect write(s: String): Unit
832832

833833
effect splice[A](x: A): Unit
834834

835-
effect Codepos(): String
835+
// Code positions
836+
// ==============
837+
//
838+
/// Allows to get the code position of the callsite of the current function
839+
effect codepos(): String

0 commit comments

Comments
 (0)