exercism / exercism/elixir-representer

Normalize struct names

Abierto
#37 12 comentarios 1 reacción 0 asignados Ver en GitHub
x:action/improve x:knowledge/elementary x:module/representer x:size/large x:type/coding
Lenguaje dominante
Elixir
Estrellas
11
Forks
8
Merge medio
11 d 3 h
PR fusionados (30 d)
1

Descripción

This is mentioned in #29.

Struct names should be replaced by placeholders as well.

## Example input

```elixir
defmodule Something do
defstruct [:a, :b]
def something(%Something{a: a}), do: %Something{a: 2 * a}
def something_else(%__MODULE__{a: a}), do: %__MODULE__{a: 3 * a}
end
```

## Desired output

```elixir
defmodule(PLACEHOLDER_1) do
defstruct([:a, :b])
def(PLACEHOLDER_2(%PLACEHOLDER_1{a: PLACEHOLDER_3})) do
%PLACEHOLDER_1{a: 2 * PLACEHOLDER_3}
end
def(PLACEHOLDER_4(%__MODULE__{a: PLACEHOLDER_3})) do
%__MODULE__{a: 3 * PLACEHOLDER_3}
end
end
```

I think `__MODULE__` should not be replaced, because it means different things in different modules. It's already normalized, in a way...

## Current output

```elixir
defmodule(PLACEHOLDER_1) do
defstruct([:a, :b])
def(PLACEHOLDER_2(%Something{a: PLACEHOLDER_3})) do
%Something{a: 2 * PLACEHOLDER_3}
end
def(PLACEHOLDER_4(%__MODULE__{a: PLACEHOLDER_3})) do
%__MODULE__{a: 3 * PLACEHOLDER_3}
end
end
```

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.