From eeff5dcdaeed36a12666e13bacf10d0bd1109f1b Mon Sep 17 00:00:00 2001 From: Jon Meow <46229924+jonmeow@users.noreply.github.com> Date: Mon, 1 Nov 2021 10:56:04 -0700 Subject: [PATCH] Mark fnty as __Fn to reflect experimental state (#928) The `__Fn` naming is intended to mirror things like `__Continuation`. The reason for this path is because it's not clear this is the form we'll want, and I think experimental naming will help reflect that. --- executable_semantics/syntax/lexer.lpp | 4 ++-- executable_semantics/syntax/parser.ypp | 4 ++-- executable_semantics/testdata/function/fnty.carbon | 2 +- executable_semantics/testdata/generic_function/apply.carbon | 2 +- .../testdata/generic_function/tuple_map.carbon | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/executable_semantics/syntax/lexer.lpp b/executable_semantics/syntax/lexer.lpp index 6fc9e7bfd142..62828dcb0236 100644 --- a/executable_semantics/syntax/lexer.lpp +++ b/executable_semantics/syntax/lexer.lpp @@ -51,7 +51,7 @@ EQUAL "=" EQUAL_EQUAL "==" FALSE "false" FN "fn" -FNTY "fnty" +FN_TYPE "__Fn" IF "if" IMPL "impl" IMPORT "import" @@ -144,7 +144,7 @@ string_literal \"([^\\\"\n\v\f\r]|\\.)*\" {EQUAL_EQUAL} { return SIMPLE_TOKEN(EQUAL_EQUAL); } {EQUAL} { return SIMPLE_TOKEN(EQUAL); } {FALSE} { return SIMPLE_TOKEN(FALSE); } -{FNTY} { return SIMPLE_TOKEN(FNTY); } +{FN_TYPE} { return SIMPLE_TOKEN(FN_TYPE); } {FN} { return SIMPLE_TOKEN(FN); } {IF} { return SIMPLE_TOKEN(IF); } {IMPL} { return SIMPLE_TOKEN(IMPL); } diff --git a/executable_semantics/syntax/parser.ypp b/executable_semantics/syntax/parser.ypp index 3aa0725134ce..ce0aead63426 100644 --- a/executable_semantics/syntax/parser.ypp +++ b/executable_semantics/syntax/parser.ypp @@ -164,7 +164,7 @@ EQUAL_EQUAL FALSE FN - FNTY + FN_TYPE IF IMPL IMPORT @@ -377,7 +377,7 @@ expression: context.source_loc(), Operator::Ptr, std::vector>({$1})); } -| FNTY tuple return_type +| FN_TYPE tuple return_type { auto [return_exp, is_omitted_exp] = $3; $$ = arena->New(context.source_loc(), $2, return_exp, diff --git a/executable_semantics/testdata/function/fnty.carbon b/executable_semantics/testdata/function/fnty.carbon index e1179d81191d..c5c7d9a095bb 100644 --- a/executable_semantics/testdata/function/fnty.carbon +++ b/executable_semantics/testdata/function/fnty.carbon @@ -16,6 +16,6 @@ fn add1(x: i32) -> i32 { } fn main() -> i32 { - var f: fnty(i32)->i32 = add1; + var f: __Fn(i32)->i32 = add1; return f(-1); } diff --git a/executable_semantics/testdata/generic_function/apply.carbon b/executable_semantics/testdata/generic_function/apply.carbon index d7e261e1296a..3cd5b839419a 100644 --- a/executable_semantics/testdata/generic_function/apply.carbon +++ b/executable_semantics/testdata/generic_function/apply.carbon @@ -11,7 +11,7 @@ package ExecutableSemanticsTest api; -fn apply[T:! Type, U:! Type](f: fnty (T) -> U, x: T) -> U { +fn apply[T:! Type, U:! Type](f: __Fn (T) -> U, x: T) -> U { return f(x); } diff --git a/executable_semantics/testdata/generic_function/tuple_map.carbon b/executable_semantics/testdata/generic_function/tuple_map.carbon index 30dd7aebbb32..4ef564d1afd7 100644 --- a/executable_semantics/testdata/generic_function/tuple_map.carbon +++ b/executable_semantics/testdata/generic_function/tuple_map.carbon @@ -11,7 +11,7 @@ package ExecutableSemanticsTest api; -fn map[T:! Type](f: fnty (T) -> T, tuple: (T, T)) -> (T, T) { +fn map[T:! Type](f: __Fn (T) -> T, tuple: (T, T)) -> (T, T) { return (f(tuple[0]), f(tuple[1])); }