-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from Rigidity/inline-definition-fix
Fix inline function inner definitions
- Loading branch information
Showing
4 changed files
with
80 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
const CONST: Int = 43874913874; | ||
|
||
fun main() -> Int { | ||
outer_1(42) + outer_2(42) + outer_3(42) + outer_4(42) + outer_closure(42)(42) | ||
} | ||
|
||
inline fun outer_closure(num_1: Int) -> fun(num: Int) -> Int { | ||
const FACTOR: Int = 2; | ||
fun inner(num_2: Int) -> Int { | ||
num_1 * num_2 * FACTOR * outer_1(num_1 * num_2) + CONST | ||
} | ||
inner | ||
} | ||
|
||
inline fun outer_1(num: Int) -> Int { | ||
inline const FACTOR: Int = 2; | ||
inline fun inner() -> Int { | ||
num * FACTOR | ||
} | ||
inner() | ||
} | ||
|
||
inline fun outer_2(num: Int) -> Int { | ||
const FACTOR: Int = 2; | ||
inline fun inner() -> Int { | ||
num * FACTOR | ||
} | ||
inner() | ||
} | ||
|
||
inline fun outer_3(num: Int) -> Int { | ||
const FACTOR: Int = 2; | ||
fun inner() -> Int { | ||
num * FACTOR | ||
} | ||
inner() | ||
} | ||
|
||
inline fun outer_4(num: Int) -> Int { | ||
inline const FACTOR: Int = 2; | ||
fun inner() -> Int { | ||
num * FACTOR | ||
} | ||
inner() | ||
} |